linux-php using Curl to call the interface speed is very slow, the domain name for the IP speed is normal.

Source: Internet
Author: User
Keywords Php linux nginx
function Requestcurl ($url, $type = ' get ', $data =null)

{    $ch = curl_init();    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);     curl_setopt($ch, CURLOPT_HEADER, false);    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);    if('post'==$type){        curl_setopt($ch, CURLOPT_POST, true);        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);    }else if('delete'==$type){        curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE");           curl_setopt($ch, CURLOPT_POSTFIELDS,$data);    }else if('put'==$type){        curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");           curl_setopt($ch, CURLOPT_POSTFIELDS,$data);    }    curl_setopt($ch, CURLOPT_URL,$url);    $infos = curl_exec($ch);    curl_close($ch);    return $infos;}

The host ping is also available. The great God for guidance is appreciated

Reply content:

function Requestcurl ($url, $type = ' get ', $data =null)

{    $ch = curl_init();    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);     curl_setopt($ch, CURLOPT_HEADER, false);    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);    if('post'==$type){        curl_setopt($ch, CURLOPT_POST, true);        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);    }else if('delete'==$type){        curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE");           curl_setopt($ch, CURLOPT_POSTFIELDS,$data);    }else if('put'==$type){        curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");           curl_setopt($ch, CURLOPT_POSTFIELDS,$data);    }    curl_setopt($ch, CURLOPT_URL,$url);    $infos = curl_exec($ch);    curl_close($ch);    return $infos;}

The host ping is also available. The great God for guidance is appreciated

DNS domain name resolution problem only. In fact, I do not know very well. You'd better make a configuration to convert the corresponding domain name to IP

  • 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.