curl_setopt在中间返回空数组

时间:2016-05-21 13:22:52

标签: php curl

function fz_json_api_get($results) {

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_URL, $results);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    $result = curl_exec($ch);
    curl_close($ch);

    $result = json_decode($result, true);

    if(empty($result)){
        echo 'Problem in getting feed data';
        return ;
    }

    return $result;
}

这个功能运作良好,但在第15页后停在中间,错误不在json中,因为它在浏览器上打开了。

0 个答案:

没有答案