Hello. I wrote a PHP script that contains a SOAP request. I used this script before and it worked perfectly. The last time I tried to use it, the query contained a large amount of data - a much larger amount of data than I had retrieved in earlier uses of the script. Every time I ran the latest script I would get either a "max_execution_time" or "500 Internal Server" error and the script would stop at the 30 second mark. I increased the "max_execution_time" on my php5.ini file and the file would continue to stop at 30 seconds. I created a phpinfo.php file which showed the php settings and the changes I made did, in fact, take effect. I am pretty new at PHP so this may have been the wrong way to try and fix this but I decided to break the query up into smaller chunks using LIMIT in the query. Initially I made 2 queries in the same script with the first as "LIMIT 0,100" and the next as "LIMIT 100,100" but it didn't work. After a while looking around, I saw the php FLUSH command and I decided that I would try it out. I placed it directly between the two queries in the script as "flush();" and it worked. I really don't know why it worked but I was desperate and happy to see some progress. I was excited until I got to the fourth and fifth set of queries. Now my script times out at 90 seconds. What now? I am thinking that it may be because I am using Windows shared hosting and iis7. I hope that I am wrong because my site is at GoDaddy and I don't think have access to any of the ii7 settings. Any ideas? Here is a snippet below to explain. I would appreciate your help tremendously.
Code:$query = "SELECT * FROM tracks WHERE id='11' LIMIT 0,100"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } while($row = mysql_fetch_array($result)){ $WSDL = 'http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx?WSDL'; $client = new SoapClient($WSDL); $response = $client->getElevation(array('X_Value'=>$row['lng'],'Y_Value'=>$row['lat'],'Elevation_Units'=>'FEET','Source_Layer'=>'-1','Elevation_Only'=>'true')); //works $elevations = $response->getElevationResult->any.' '; echo $elevations; } flush(); $query2 = "SELECT * FROM tracks WHERE id='11' LIMIT 100,100"; $result2 = mysql_query($query2); if (!$result2) { die('Invalid query: ' . mysql_error()); } while($row = mysql_fetch_array($result2)){ $WSDL = 'http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx?WSDL'; $client = new SoapClient($WSDL); $response = $client->getElevation(array('X_Value'=>$row['lng'],'Y_Value'=>$row['lat'],'Elevation_Units'=>'FEET','Source_Layer'=>'-1','Elevation_Only'=>'true')); //works $elevations2 = $response->getElevationResult->any.' '; echo $elevations2; } flush(); $query3 = "SELECT * FROM tracks WHERE id='11' LIMIT 200,100"; $result3 = mysql_query($query3); if (!$result3) { die('Invalid query: ' . mysql_error()); } while($row = mysql_fetch_array($result3)){ $WSDL = 'http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx?WSDL'; $client = new SoapClient($WSDL); $response = $client->getElevation(array('X_Value'=>$row['lng'],'Y_Value'=>$row['lat'],'Elevation_Units'=>'FEET','Source_Layer'=>'-1','Elevation_Only'=>'true')); //works $elevations3 = $response->getElevationResult->any.' '; echo $elevations3; } flush(); $query4 = "SELECT * FROM tracks WHERE id='11' LIMIT 300,100"; $result4 = mysql_query($query4); if (!$result4) { die('Invalid query: ' . mysql_error()); } while($row = mysql_fetch_array($result4)){ $WSDL = 'http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx?WSDL'; $client = new SoapClient($WSDL); $response = $client->getElevation(array('X_Value'=>$row['lng'],'Y_Value'=>$row['lat'],'Elevation_Units'=>'FEET','Source_Layer'=>'-1','Elevation_Only'=>'true')); //works $elevations4 = $response->getElevationResult->any.' '; echo $elevations4; }



Reply With Quote

Bookmarks