0
votes

URL Fetch overview says:

You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 60 seconds for HTTP requests and 10 minutes for task queue and cron job requests.

Now, how can i set deadline to 60-sec?

3

3 Answers

2
votes

I'm assuming your asking for a PHP app.

Set the deadline in the http context, per this documentation.

$options = ["http" => ["timeout" => 60]];
$context = stream_context_create($options);
$data = file_get_contents("http://foo.bar", false, $context);
0
votes

Add the parameter deadline=60. See the fetch documentation here.

0
votes

try this

$context =
    array("http"=>
      array(
        "timeout" => 60
      )
    );
$context = stream_context_create($context);
$result = file_get_contents("http://example.com", false, $contex);