0

curl在 php 中使用后期处理来获取网站页面信息作为响应。我正在使用以下代码。

    $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卷曲信息错误。有人能澄清一下吗?

4

0 回答 0