0

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?

1moretime
  • 11
  • 2

3 Answers3

2

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);
Stuart Langley
  • 7,044
  • 1
  • 20
  • 20
0

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

Jude Osborn
  • 1,788
  • 16
  • 24
0

try this

$context =
    array("http"=>
      array(
        "timeout" => 60
      )
    );
$context = stream_context_create($context);
$result = file_get_contents("http://example.com", false, $contex);
ewwink
  • 18,382
  • 2
  • 44
  • 54