我在php中使用curl
帖子处理来获取网站页面信息作为回复。我使用以下代码。
$ch = curl_init();
$_POST = array(
'ddlBoro' => 'Manhattan',
'txtHouseNo' => '2395',
'txtStreet' => '1 Ave',
'RadioStrOrBlk'=> 'Street',
'__EVENTTARGET'=> '',
'__EVENTARGUMENT'=> '',
'_ctl0'=>'_ctl0',
'SearchButton' => 'Search'
);
$url= 'http://xxx/xx/test.aspx';
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$_POST);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close ($ch);
echo("Results: <br>".$response);
echo "<pre>info";print_r($info);echo "</pre>";
但我总是将http code 500
作为卷曲信息错误。任何人都可以澄清一下吗?