protected function curl_vm_record($url, $platform, $authorization, $jsonStr) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt( $ch, CURLOPT_USERAGENT , 'LEE' ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 20 ); curl_setopt( $ch, CURLOPT_TIMEOUT , 20); curl_setopt( $ch, CURLOPT_RETURNTRANSFER , TRUE ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json; charset=utf-8', 'Platform:'.$platform, 'Authorization:'.$authorization, 'Content-Length:' . strlen($jsonStr) ) ); curl_setopt( $ch , CURLOPT_POST , TRUE ); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr); curl_setopt( $ch , CURLOPT_URL , $url ); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return array($httpCode, $response); }
$data = array('id' => $id, 'isCheck' => $isCheck); $url = ''; $platform = 101; $authorization = $token; $postdata = array('url'=>$url,'platform'=>$platform,'authorization'=>$authorization,'data'=>$data); logfile(print_r($postdata, true), 'logfile'); $result = $this->curl_vm_record($url, $platform, $authorization,json_encode($data)); logfile(print_r($result, true), 'logfile');