1

My PHP app on GAE shows error logs:

PHP Warning: file_get_contents(http://cx.xaa.cc/checkgs.asp): failed to open stream: Request deadline exceeded in /base/data/home/apps/s~turn-get-into-post/1.367938585442433732/turn-get-into-post.php on line 94

Any ideas?

1moretime
  • 11
  • 2
  • 1
    check this http://stackoverflow.com/questions/14698119/httpexception-deadline-exceeded-while-waiting-for-http-response-from-url-dead – Hawili Jun 08 '13 at 11:35
  • 1
    https://developers.google.com/appengine/articles/deadlineexceedederrors – Farkie Jun 08 '13 at 11:39

1 Answers1

3

You're seeing this error because the server at http://cx.xaa.cc/checkgs.asp is taking too long to respond. By default URLfetch (the App Engine service which powers file_get_contents() on PHP in GAE when using a http or https URL) has a default timeout of 5 seconds.

Ordinarilly you can extend this to 60 seconds by specifying a timeout in the configuration array, as follows:

$data = http_build_query($data); 
$context = 
   array("http"=> 
      array( 
         "method" => "POST", 
         "content" => $data, 
         "timeout" => 60 
   ) 
); 
$context = stream_context_create($context); 
$result = file_get_contents($url, false, $context); 

However in the short term be aware of this bug. https://code.google.com/p/googleappengine/issues/detail?id=9460

Andrew J
  • 1,816
  • 14
  • 16