PHP Curl Slowness

前端 未结 7 869
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 02:44

For some reason my curl call is very slow. Here is the code I used.

$postData = \"test\"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,         


        
相关标签:
7条回答
  • 2021-02-04 03:11

    I just resolved this exact problem by removing the following two options:

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    

    Somehow on the site I was fetching, the POST request to over ten full seconds. If it's GET, it's less than a second.

    So... in my wrapper function that does the Curl requests, it now only sets those two options when there is something in $postData

    0 讨论(0)
提交回复
热议问题