Heim >Backend-Entwicklung >PHP-Tutorial >php curl怎么以get方式提交
例如:http://localhost/openapi/holiday/Line/Query/GetLineComment?AllianceId=12&DigitalSign=7aeac3d1c621c30c144f23b5a498bbda01895b70&ReqTime=2013-09-02 16:23:49.929
这个地址用get怎么提交
例如:http://localhost/openapi/holiday/Line/Query/GetLineComment?AllianceId=12&DigitalSign=7aeac3d1c621c30c144f23b5a498bbda01895b70&ReqTime=2013-09-02 16:23:49.929
这个地址用get怎么提交
curl 默认就是以 GET 提交的,如果为POST提交,请检查是否配置了 curl_setopt($c, CURLOPT_POST, 1); 这个参数
<code> /** * GET 请求 * @param string $url */ private function http_get($url){ $oCurl = curl_init(); if(stripos($url,"https://")!==FALSE){ curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1 } curl_setopt($oCurl, CURLOPT_URL, $url); curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 ); //增加代理 //curl_setopt($oCurl, CURLOPT_PROXY, HTTP_PROXY_IP_PORT); $sContent = curl_exec($oCurl); $aStatus = curl_getinfo($oCurl); curl_close($oCurl); if(intval($aStatus["http_code"])==200){ return $sContent; }else{ return false; } }</code>
file_get_contents