[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-03 Thread 1moretime
Thanks, Dan

I read that doc but PHP version not found.
would you pls give some php code?


On Jun 4, 4:16 am, Dan Holevoet  wrote:
> This is a great question for the App Engine Stack Overflow
> tag,
> which also conveniently happens to have an
> answerfor
> you!
>
> Thanks,
> Dan
>
>
>
>
>
>
>
>
>
> On Mon, Jun 3, 2013 at 8:20 AM, 1moretime  wrote:
> > 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 ?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to google-appengine+unsubscr...@googlegroups.com.
> > To post to this group, send email to google-appengine@googlegroups.com.
> > Visit this group athttp://groups.google.com/group/google-appengine?hl=en.
> > For more options, visithttps://groups.google.com/groups/opt_out.
>
> --
> Dan Holevoet
> Google Developer Relations

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-04 Thread 1moretime
Hi, Stuart
Thanks for your reply,
I tried following code, but failed.


$data = http_build_query($data);
$context =
array("http"=>
  array(
"method" => "POST",
"content" => $data,
//"header" => "Connection: keep-alive\r\n",
//"deadline" => 60, // The deadline can be up to a maximum
of 60 seconds for request handlers
"timeout" => 30 // GAE requests have a 30-second deadline
  )
);
$context = stream_context_create($context);

$result = file_get_contents($url, false, $context);




Still got same warning message in gae logs.



PHP Warning:  file_get_contents(..): failed to open
stream: Request deadline exceeded in /base/data/home/apps/.php
on line 93




Any suggestion?



On Jun 4, 5:56 pm, Stuart Langley  wrote:
> set the timeout value in the http context to the number of seconds you want
> the deadline to be.
>
>
>
>
>
>
>
> On Tuesday, 4 June 2013 12:05:29 UTC+10, 1moretime wrote:
>
> > Thanks, Dan
>
> > I read that doc but PHP version not found.
> > would you pls give some php code?
>
> > On Jun 4, 4:16 am, Dan Holevoet  wrote:
> > > This is a great question for the App Engine Stack Overflow
> > > tag,
> > > which also conveniently happens to have an
> > > answer<
> >http://stackoverflow.com/questions/2162115/how-to-set-timeout-for-url...>for
>
> > > you!
>
> > > Thanks,
> > > Dan
>
> > > On Mon, Jun 3, 2013 at 8:20 AM, 1moretime 
> > wrote:
> > > > 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 ?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Google App Engine" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send
> > an
> > > > email to google-appengi...@googlegroups.com .
> > > > To post to this group, send email to 
> > > > google-a...@googlegroups.com.
>
> > > > Visit this group athttp://
> > groups.google.com/group/google-appengine?hl=en.
> > > > For more options, visithttps://groups.google.com/groups/opt_out.
>
> > > --
> > > Dan Holevoet
> > > Google Developer Relations

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-04 Thread Vinny P
Can you tell us what URL you're connecting to? The server may be slow or be 
difficult to resolve.

I would suggest using *stream_get_meta_data* ( 
http://us3.php.net/stream_get_meta_data ) to inspect the stream and see 
what exactly is going on - you'll get a more detailed error message.

-
-Vinny P
Technology & Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/

On Tuesday, June 4, 2013 6:51:47 AM UTC-5, 1moretime wrote:
>
> Hi, Stuart 
> Thanks for your reply, 
> I tried following code, but failed. 
>
>  
> $data = http_build_query($data); 
> $context = 
> array("http"=> 
>   array( 
> "method" => "POST", 
> "content" => $data, 
> //"header" => "Connection: keep-alive\r\n", 
> //"deadline" => 60, // The deadline can be up to a maximum 
> of 60 seconds for request handlers 
> "timeout" => 30 // GAE requests have a 30-second deadline 
>   ) 
> ); 
> $context = stream_context_create($context); 
>
> $result = file_get_contents($url, false, $context); 
>
>  
>
>
> Still got same warning message in gae logs. 
>
>  
>
> PHP Warning:  file_get_contents(..): failed to open 
> stream: Request deadline exceeded in /base/data/home/apps/.php 
> on line 93 
>
>  
>
>
> Any suggestion? 
>
>
>
> On Jun 4, 5:56 pm, Stuart Langley  wrote: 
> > set the timeout value in the http context to the number of seconds you 
> want 
> > the deadline to be. 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, 4 June 2013 12:05:29 UTC+10, 1moretime wrote: 
> > 
> > > Thanks, Dan 
> > 
> > > I read that doc but PHP version not found. 
> > > would you pls give some php code? 
> > 
> > > On Jun 4, 4:16 am, Dan Holevoet  wrote: 
> > > > This is a great question for the App Engine Stack Overflow 
> > > > tag, 
> > > > which also conveniently happens to have an 
> > > > answer< 
> > >http://stackoverflow.com/questions/2162115/how-to-set-timeout-for-url...>for
> > > 
>
> > 
> > > > you! 
> > 
> > > > Thanks, 
> > > > Dan 
> > 
> > > > On Mon, Jun 3, 2013 at 8:20 AM, 1moretime  
> > > wrote: 
> > > > > 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 ? 
> > 
> > > > > -- 
> > > > > You received this message because you are subscribed to the Google 
> > > Groups 
> > > > > "Google App Engine" group. 
> > > > > To unsubscribe from this group and stop receiving emails from it, 
> send 
> > > an 
> > > > > email to google-appengi...@googlegroups.com . 
> > > > > To post to this group, send email to 
> > > > > google-a...@googlegroups.com. 
>
> > 
> > > > > Visit this group athttp:// 
> > > groups.google.com/group/google-appengine?hl=en. 
> > > > > For more options, visithttps://groups.google.com/groups/opt_out. 
> > 
> > > > -- 
> > > > Dan Holevoet 
> > > > Google Developer Relations 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-04 Thread 1moretime
Thanks Vinny

I'm trying to POST data to http://cx.xaa.cc/checksn.asp with gae php.
It seems that my post request written in php closed in about 5
seconds,
so i guess my request deadline was not set properly.
GAE don't support fclose, so i don't know how to use
stream_get_meta_data.

Jason


On Jun 5, 2:52 am, Vinny P  wrote:
> Can you tell us what URL you're connecting to? The server may be slow or be
> difficult to resolve.
>
> I would suggest using *stream_get_meta_data* 
> (http://us3.php.net/stream_get_meta_data) to inspect the stream and see
> what exactly is going on - you'll get a more detailed error message.
>
> -
> -Vinny P
> Technology & Media Advisor
> Chicago, IL
>
> My Go side project:http://invalidmail.com/
>
>
>
>
>
>
>
> On Tuesday, June 4, 2013 6:51:47 AM UTC-5, 1moretime wrote:
>
> > Hi, Stuart
> > Thanks for your reply,
> > I tried following code, but failed.
>
> > 
> >     $data = http_build_query($data);
> >     $context =
> >         array("http"=>
> >           array(
> >             "method" => "POST",
> >             "content" => $data,
> >             //"header" => "Connection: keep-alive\r\n",
> >             //"deadline" => 60, // The deadline can be up to a maximum
> > of 60 seconds for request handlers
> >             "timeout" => 30 // GAE requests have a 30-second deadline
> >           )
> >         );
> >     $context = stream_context_create($context);
>
> >     $result = file_get_contents($url, false, $context);
>
> > 
>
> > Still got same warning message in gae logs.
>
> > 
>
> > PHP Warning:  file_get_contents(..): failed to open
> > stream: Request deadline exceeded in /base/data/home/apps/.php
> > on line 93
>
> > 
>
> > Any suggestion?
>
> > On Jun 4, 5:56 pm, Stuart Langley  wrote:
> > > set the timeout value in the http context to the number of seconds you
> > want
> > > the deadline to be.
>
> > > On Tuesday, 4 June 2013 12:05:29 UTC+10, 1moretime wrote:
>
> > > > Thanks, Dan
>
> > > > I read that doc but PHP version not found.
> > > > would you pls give some php code?
>
> > > > On Jun 4, 4:16 am, Dan Holevoet  wrote:
> > > > > This is a great question for the App Engine Stack Overflow
> > > > > tag,
> > > > > which also conveniently happens to have an
> > > > > answer<
> > > >http://stackoverflow.com/questions/2162115/how-to-set-timeout-for-url...>for
>
> > > > > you!
>
> > > > > Thanks,
> > > > > Dan
>
> > > > > On Mon, Jun 3, 2013 at 8:20 AM, 1moretime 
> > > > wrote:
> > > > > > 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 ?
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "Google App Engine" group.
> > > > > > To unsubscribe from this group and stop receiving emails from it,
> > send
> > > > an
> > > > > > email to google-appengi...@googlegroups.com .
> > > > > > To post to this group, send email to 
> > > > > > google-a...@googlegroups.com.
>
> > > > > > Visit this group athttp://
> > > > groups.google.com/group/google-appengine?hl=en.
> > > > > > For more options, visithttps://groups.google.com/groups/opt_out.
>
> > > > > --
> > > > > Dan Holevoet
> > > > > Google Developer Relations

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-05 Thread Stuart Langley
Not sure what you mean by "doesn't support fclose()".

// This works fine.
$fp = fopen("gs://sjl-test/song.ogg", "r");
var_dump(fstat($fp));
fclose($fp);

Buut  It looks like stream_get_meta_data doesn't return anything - 
I'll need to find out why.

On Wednesday, 5 June 2013 11:13:38 UTC+10, 1moretime wrote:
>
> Thanks Vinny 
>
> I'm trying to POST data to http://cx.xaa.cc/checksn.asp with gae php. 
> It seems that my post request written in php closed in about 5 
> seconds, 
> so i guess my request deadline was not set properly. 
> GAE don't support fclose, so i don't know how to use 
> stream_get_meta_data. 
>
> Jason 
>
>
> On Jun 5, 2:52 am, Vinny P  wrote: 
> > Can you tell us what URL you're connecting to? The server may be slow or 
> be 
> > difficult to resolve. 
> > 
> > I would suggest using *stream_get_meta_data* (
> http://us3.php.net/stream_get_meta_data) to inspect the stream and see 
> > what exactly is going on - you'll get a more detailed error message. 
> > 
> > - 
> > -Vinny P 
> > Technology & Media Advisor 
> > Chicago, IL 
> > 
> > My Go side project:http://invalidmail.com/ 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, June 4, 2013 6:51:47 AM UTC-5, 1moretime wrote: 
> > 
> > > Hi, Stuart 
> > > Thanks for your reply, 
> > > I tried following code, but failed. 
> > 
> > >  
> > > $data = http_build_query($data); 
> > > $context = 
> > > array("http"=> 
> > >   array( 
> > > "method" => "POST", 
> > > "content" => $data, 
> > > //"header" => "Connection: keep-alive\r\n", 
> > > //"deadline" => 60, // The deadline can be up to a maximum 
> > > of 60 seconds for request handlers 
> > > "timeout" => 30 // GAE requests have a 30-second deadline 
> > >   ) 
> > > ); 
> > > $context = stream_context_create($context); 
> > 
> > > $result = file_get_contents($url, false, $context); 
> > 
> > >  
> > 
> > > Still got same warning message in gae logs. 
> > 
> > >  
> > 
> > > PHP Warning:  file_get_contents(..): failed to open 
> > > stream: Request deadline exceeded in /base/data/home/apps/.php 
> > > on line 93 
> > 
> > >  
> > 
> > > Any suggestion? 
> > 
> > > On Jun 4, 5:56 pm, Stuart Langley  wrote: 
> > > > set the timeout value in the http context to the number of seconds 
> you 
> > > want 
> > > > the deadline to be. 
> > 
> > > > On Tuesday, 4 June 2013 12:05:29 UTC+10, 1moretime wrote: 
> > 
> > > > > Thanks, Dan 
> > 
> > > > > I read that doc but PHP version not found. 
> > > > > would you pls give some php code? 
> > 
> > > > > On Jun 4, 4:16 am, Dan Holevoet  
> wrote: 
> > > > > > This is a great question for the App Engine Stack Overflow 
> > > > > > tag, 
>
> > > > > > which also conveniently happens to have an 
> > > > > > answer< 
> > > > >
> http://stackoverflow.com/questions/2162115/how-to-set-timeout-for-url...>for 
>
> > 
> > > > > > you! 
> > 
> > > > > > Thanks, 
> > > > > > Dan 
> > 
> > > > > > On Mon, Jun 3, 2013 at 8:20 AM, 1moretime  
>
> > > > > wrote: 
> > > > > > > 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 ? 
> > 
> > > > > > > -- 
> > > > > > > You received this message because you are subscribed to the 
> Google 
> > > > > Groups 
> > > > > > > "Google App Engine" group. 
> > > > > > > To unsubscribe from this group and stop receiving emails from 
> it, 
> > > send 
> > > > > an 
> > > > > > > email to google-appengi...@googlegroups.com . 
> > > > > > > To post to this group, send email to 
> google-a...@googlegroups.com. 
> > 
> > > > > > > Visit this group athttp:// 
> > > > > groups.google.com/group/google-appengine?hl=en. 
> > > > > > > For more options, visithttps://
> groups.google.com/groups/opt_out. 
> > 
> > > > > > -- 
> > > > > > Dan Holevoet 
> > > > > > Google Developer Relations 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: How to set deadline for a PHP URL fetch?

2013-06-05 Thread Stuart Langley
Tried this as well.

file_get_contents("http://cx.xaa.cc/checksn.asp";);
var_dump($http_response_header);



array(11) {
  [0]=>
  string(15) "HTTP/1.1 200 OK"
  [1]=>
  string(17) "Connection: close"
  [2]=>
  string(35) "Date: Wed, 05 Jun 2013 07:35:38 GMT"
  [3]=>
  string(25) "Server: Microsoft-IIS/6.0"
  [4]=>
  string(21) "X-Powered-By: ASP.NET"
  [5]=>
  string(20) "Content-Length: 1086"
  [6]=>
  string(23) "Content-Type: text/html"
  [7]=>
  string(65) "Set-Cookie: ASPSESSIONIDQCBBDSTC=DEEPGAHDFGIKBJAAOFHOGEPM; 
path=/"
  [8]=>
  string(22) "Cache-control: private"
  [9]=>
  string(36) "X-Google-Cache-Control: remote-fetch"
  [10]=>
  string(17) "Via: HTTP/1.1 GWA"
}

On Wednesday, 5 June 2013 11:13:38 UTC+10, 1moretime wrote:
>
> Thanks Vinny 
>
> I'm trying to POST data to http://cx.xaa.cc/checksn.asp with gae php. 
> It seems that my post request written in php closed in about 5 
> seconds, 
> so i guess my request deadline was not set properly. 
> GAE don't support fclose, so i don't know how to use 
> stream_get_meta_data. 
>
> Jason 
>
>
> On Jun 5, 2:52 am, Vinny P  wrote: 
> > Can you tell us what URL you're connecting to? The server may be slow or 
> be 
> > difficult to resolve. 
> > 
> > I would suggest using *stream_get_meta_data* (
> http://us3.php.net/stream_get_meta_data) to inspect the stream and see 
> > what exactly is going on - you'll get a more detailed error message. 
> > 
> > - 
> > -Vinny P 
> > Technology & Media Advisor 
> > Chicago, IL 
> > 
> > My Go side project:http://invalidmail.com/ 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, June 4, 2013 6:51:47 AM UTC-5, 1moretime wrote: 
> > 
> > > Hi, Stuart 
> > > Thanks for your reply, 
> > > I tried following code, but failed. 
> > 
> > >  
> > > $data = http_build_query($data); 
> > > $context = 
> > > array("http"=> 
> > >   array( 
> > > "method" => "POST", 
> > > "content" => $data, 
> > > //"header" => "Connection: keep-alive\r\n", 
> > > //"deadline" => 60, // The deadline can be up to a maximum 
> > > of 60 seconds for request handlers 
> > > "timeout" => 30 // GAE requests have a 30-second deadline 
> > >   ) 
> > > ); 
> > > $context = stream_context_create($context); 
> > 
> > > $result = file_get_contents($url, false, $context); 
> > 
> > >  
> > 
> > > Still got same warning message in gae logs. 
> > 
> > >  
> > 
> > > PHP Warning:  file_get_contents(..): failed to open 
> > > stream: Request deadline exceeded in /base/data/home/apps/.php 
> > > on line 93 
> > 
> > >  
> > 
> > > Any suggestion? 
> > 
> > > On Jun 4, 5:56 pm, Stuart Langley  wrote: 
> > > > set the timeout value in the http context to the number of seconds 
> you 
> > > want 
> > > > the deadline to be. 
> > 
> > > > On Tuesday, 4 June 2013 12:05:29 UTC+10, 1moretime wrote: 
> > 
> > > > > Thanks, Dan 
> > 
> > > > > I read that doc but PHP version not found. 
> > > > > would you pls give some php code? 
> > 
> > > > > On Jun 4, 4:16 am, Dan Holevoet  
> wrote: 
> > > > > > This is a great question for the App Engine Stack Overflow 
> > > > > > tag, 
>
> > > > > > which also conveniently happens to have an 
> > > > > > answer< 
> > > > >
> http://stackoverflow.com/questions/2162115/how-to-set-timeout-for-url...>for 
>
> > 
> > > > > > you! 
> > 
> > > > > > Thanks, 
> > > > > > Dan 
> > 
> > > > > > On Mon, Jun 3, 2013 at 8:20 AM, 1moretime  
>
> > > > > wrote: 
> > > > > > > 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 ? 
> > 
> > > > > > > -- 
> > > > > > > You received this message because you are subscribed to the 
> Google 
> > > > > Groups 
> > > > > > > "Google App Engine" group. 
> > > > > > > To unsubscribe from this group and stop receiving emails from 
> it, 
> > > send 
> > > > > an 
> > > > > > > email to google-appengi...@googlegroups.com . 
> > > > > > > To post to this group, send email to 
> google-a...@googlegroups.com. 
> > 
> > > > > > > Visit this group athttp:// 
> > > > > groups.google.com/group/google-appengine?hl=en. 
> > > > > > > For more options, visithttps://
> groups.google.com/groups/opt_out. 
> > 
> > > > > > -- 
> > > > > > Dan Holevoet 
> > > > > > Google Developer Relations 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this