中文论坛 (Forum for Chinese Speakers)

Moderator: yuhesky

#796038
我使用如下代码, the HTTP status code is 200,但是为什么变量typeCurrentTask的值没有改变?
Code: Select all
$url = "http://localhost:8000/api/1.0/workflow/cases/50717163059fbdd26bdfe40007504612/variable";
$postParams = array(
                    "typeCurrentTask" => "1"
                    //'textVar_days'    => 5,
                    //'testVar000001'  => 'test00001'
                );
$this->pmRestRequest("PUT",$url,$postParams,$accessToken);
Last edited by xiaobai on Fri Nov 03, 2017 3:37 am, edited 2 times in total.
#796039
My pmRestRequest code:
Code: Select all
public function pmRestRequest($method = "GET",$url,$postParams = null,$accessToken){
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".$accessToken));

        switch ($method){
            case "GET" : 
                curl_setopt($ch, CURLOPT_HTTPGET, true);
                break;
            case "POST": 
                curl_setopt($ch, CURLOPT_POST,true);
                curl_setopt($ch, CURLOPT_POSTFIELDS,$postParams);
                break;
            case "PUT" : 
                curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");
                curl_setopt($ch, CURLOPT_POSTFIELDS,$postParams);
                break;
            case "PATCH": 
                curl_setopt($ch, CULROPT_CUSTOMREQUEST, 'PATCH');
                curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
                break;
            case "DELETE":
                curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
                curl_setopt($ch, CURLOPT_POSTFIELDS,$postParams);
                break;
        }
        
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        //curl_setopt($ch, CURLOPT_POST, 1);
        //curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);        
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $ret = json_decode(curl_exec($ch));
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        if ($statusCode != 200) {
            print "Error in HTTP status code: $httpStatus\n";
            return null;
        }else{
            return $ret;
        }
    }
Last edited by xiaobai on Fri Nov 03, 2017 4:49 am, edited 1 time in total.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]