curl问题从网站获取数据

时间:2016-05-02 01:04:03

标签: curl

我使用此代码从网站pj.ma/pagesjaunes获取姓名和电话,但在执行时会出错,可以帮忙吗?

<?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.pj.ma/pagesjaunes");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "pro_quiquoi=britel&pro_ou=casablanca&x=85&y=35");

    $output=curl_exec($ch);
    curl_close($ch);
    echo $output;
?>

0 个答案:

没有答案