卷曲错误 - 资源ID#88

时间:2015-10-02 06:38:00

标签: php curl libcurl

我正在尝试执行以下curl代码:

$URL = "https://app.getresponse.com/add_subscriber.htm";
$post_data = "name=ABC&email=myemail@gmail.com&campaign_token=poga1&start_day=0&";


$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);

运行此curl会给出:资源ID#88

任何线索?

1 个答案:

答案 0 :(得分:0)

    $URL = "https://app.getresponse.com/add_subscriber.htm";
    $post_data = "name=ABC&email=myemail@gmail.com&campaign_token=poga1&start_day=0&";   

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
    echo "<pre>";
    print_r($response);

问题是您没有分配卷曲执行的响应