2
votes

I am using REQUEST libary(https://github.com/rmccue/Requests) for php to make the http request and getting timeout error all the time . How can i solve this problem? This is small piece of my code:

 $response = Requests::get($link,
            array(
                'Accept'=>'application/json',
                'Accept-Charset'=>'utf-8',
                "Connection"=> "keep-alive",
            ));

Error :

cURL error 28: Operation timed out after 10335 milliseconds with 0 out of -1 bytes received

1
Which URL are you requesting? Is there anyone responding to GET requests on that address? - Rovanion
You need to add more information in order for others to be able to help you. What kind of error are you seeing? If you make the connection yourself via curl, do you see the result? - AlBlue
Ya I am getting the response from that link. Its just large pile of data and after sometime of pulling datas it got stuck due to the timeout error - Kais

1 Answers

1
votes

try this

$response = Requests::get($link,
        array(
            'Accept'=>'application/json',
            'Accept-Charset'=>'utf-8',
            "Connection"=> "keep-alive",
        ),array('timeout'=>0));

worked for me. Happy Coding :)