curl---get||post
get
private function getcalldata($concurrent){ //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 //这是用get方式传值 $resurl=$this->url.'&Number='.$concurrent; $res=$this->http_post($resurl, ''); return $res; } /** * 发送https请求,需要开启php_curl * Enter description here ... * @param unknown_type $url * @param unknown_type $data */ private function http_post($url, $data){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); if (curl_errno($curl)) { return 'Error: '.curl_error($curl); } curl_close($curl); return $output; }
post private function getcalldata($concurrent){ //这是用post方式传值 $resurl= '1111111';
$data['data'] = json_encode($resurt);
$res=$this->http_post($resurl, );
return $res; } /** * 发送https请求,需要开启php_curl * Enter description here ... * @param unknown_type $url * @param unknown_type $data */ private function http_post($url, $data){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); if (curl_errno($curl)) { return 'Error: '.curl_error($curl); } curl_close($curl); return $output; }