Kais
Kais

Reputation: 2008

I am getting timeout error while making http GET request

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

Upvotes: 2

Views: 1118

Answers (1)

Ashok Poudel
Ashok Poudel

Reputation: 266

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 :)

Upvotes: 1

Related Questions