I’m using HttpRequest and HttpRequestPool to send parallel http requests, the number of requests is up to 200 or something, the thing is that some of the receivers might be offline, so that HttpRequestPool::send() will wait until it gets a response or until it times out.
Example of usage:
$query = "CALL GetBoardsURLS()";
$result = mysql_query($query) or die("ERROR:QUERY_FAILED 8" . mysql_error());
$pool = new HttpRequestPool();
//Add the data to the request pool.
while($row = mysql_fetch_row($result))
{
$req = new HttpRequest($row[0].'/', HTTP_METH_POST);
$req->setBody($message);
$pool->attach($req);
}
$pool->send();
In my php error log i get errors, can someone tell me what I have to do to avoid them? I’m guessing that this happens mostly because of timed out requests to invalid destinations, becaues all receivers that are valid do get the message and act accordingly.
Any suggestions?
Ty in advance.
**ERRORS**:
[13-Nov-2012 14:20:00 UTC] PHP Fatal error: Uncaught exception HttpRequestPoolException' with message 'Exception caused by 2 inner exception(s)' in C:\inetpub\wwwroot\DeusTesting\TimeSet.php:130
inner exception 'HttpInvalidParamException' with message 'Empty or too short HTTP message: ''' in C:\inetpub\wwwroot\DeusTesting\TimeSet.php:0
inner exception 'HttpRequestException' with message 'Timeout was reached; Connection time-out (http://sim6261.agni.lindenlab.com:12046/cap/11b23456-63bd-1c56-8692-b640ac992a76/)' in C:\inetpub\wwwroot\DeusTesting\TimeSet.php:130
Stack trace:
#0 C:\inetpub\wwwroot\DeusTesting\TimeSet.php(0): HttpRequestPool->send()
#1 {main}
thrown in C:\inetpub\wwwroot\DeusTesting\TimeSet.php on line 130
[13-Nov-2012 14:30:03 UTC] PHP Fatal error: Uncaught exception 'HttpRequestPoolException' with message 'Exception caused by 12 inner exception(s)' in C:\inetpub\wwwroot\DeusTesting\TimeSet.php:130
Okay, this question was around here for a while and not answered. So I’ll say what I did to get rid of the errors.
The “errors” were exceptions, and since I didn’t handle them they were added in the
php53_errors.log. Now by adding try and catch, the exceptions could be handled so that solved it. Now I store the exceptions(timeout exceptions) in a separate file (that’s because i wanted to) someone else can handle them differently of course. So not much I can do about it.NEXT
This is the part I like. Since I don’t really care about the response, I just want my http requests to get transmited to the receivers. I put a timeout of 3 seconds. That prevents my script from keep running and waiting for the responses.
Hope this will help someone. Cheers