Yii-curl command line request is not slow, but PHP curl_exec is slow, what's going on?

Source: Internet
Author: User
Keywords Curl php yii
Question: Title.

curl "http://xxx.com.cn/api/open" --data "access_token=4CC7D18986B8987663E57F3CA0A87198&once=cSTvPM2h9lts&timestamp=1464951645705&sign=2da0302f6aa7b01a5cfa964d818109df&version=1.0&format=JSON&sign_type=MD5&attach=&method=open.jewelStatus.modify&data="%"7B"%"22orderId"%"22"%"3A"%"22413"%"22"%"2C"%"22status"%"22"%"3A100"%"2C"%"22operation"%"22"%"3A2"%"7D" --compressed% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 Dload  Upload   Total   Spent    Left  Speed 100   400    0   118  100   282     77    184  0:00:01  0:00:01   --:--:--   186{"attach":"","errmsg":"","result":"{}","sign":"0ec35efd5c6500baa566937950a9cb40","status":"1000","timestamp":"1465006446020"}
    $url = Yii::$app->params['erp_api']['url'];    $ch = curl_init();    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    // post数据    curl_setopt($ch, CURLOPT_POST, 1);    // post的变量    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);    $output = curl_exec($ch);//**<=Maximum execution time of 30 seconds exceeded**    curl_close($ch);    

But, strangely, I use xdebug tracking, actually can run through.
Have you encountered this problem? Solve, thank you!

Reply content:

Question: Title.

curl "Http://xxx.com.cn/api/open"--data "access_token= 4cc7d18986b8987663e57f3ca0a87198&once=cstvpm2h9lts&timestamp=1464951645705&sign= 2da0302f6aa7b01a5cfa964d818109df&version=1.0&format=json&sign_type=md5&attach=&method= Open.jewelstatus.modify&data= "%" 7B "%" 22orderId "%" "%" 3 A "%" 22413 "%" "%" 2C "%" 22status "%"% "%" 3a100 "%" 2C "%"                                 22operation "%" of "%" 3A2 "%" 7D "--compressed% total% Received% xferd Average speed time time Dload Upload Total spent left speed 100 400 0 118 100 282 77 184 0 : 00:01 0:00:01--:--:--186{"Attach": "", "ErrMsg": "", "result": "{}", "Sign": "0EC35EFD5C6500BAA566937950A9CB40", " Status ":" + "," timestamp ":" 1465006446020 "}  
    $url = Yii::$app->params['erp_api']['url'];    $ch = curl_init();    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    // post数据    curl_setopt($ch, CURLOPT_POST, 1);    // post的变量    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);    $output = curl_exec($ch);//**<=Maximum execution time of 30 seconds exceeded**    curl_close($ch);    

But, strangely, I use xdebug tracking, actually can run through.
Have you encountered this problem? Solve, thank you!

The problem has been found.
The URL that was originally requested is timed out in the PHP program environment. However, the Xdebug or editor may have set a time-out, so it can run through.

    1. Use Curl to set the time-out, or you don't know if it's a curl timeout.

    2. The weird problem is that it requires a thorough examination to determine the problem.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.