CURL

CURL

  • curl是利用URL语法在命令行方式下工作的开源文件传输工具。它被广泛应用在Unix、多种Linux发行版中,并且有DOS和Win32、Win64下的移植版本。
  • CURL课程
  • CURL参数


  • WebService


  
    
      %s
    
  
','北京');
$curlobj = curl_init(); 
curl_setopt($curlobj, CURLOPT_URL, "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx");  
curl_setopt($curlobj, CURLOPT_POST, 1);  
curl_setopt($curlobj, CURLOPT_HEADER, 0); 
curl_setopt($curlobj, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($curlobj, CURLOPT_POSTFIELDS, $data);  
curl_setopt($curlobj, CURLOPT_HTTPHEADER, array("Content-Type: application/soap+xml; charset=utf-8", 
    "Content-length: ".strlen($data),
    "SOAPAction:\"http://WebXml.com.cn/getWeatherbyCityName\"")); 
$rtn = curl_exec($curlobj);   
if(!curl_errno($curlobj)){
    $info = curl_getinfo($curlobj); 
    print_r($info);
    echo "RETURN: " . $rtn;  
} else {
  echo 'Curl error: ' . curl_error($curlobj);
}
curl_close($curlobj);
?>

你可能感兴趣的:(CURL)