Stop Script Execution after set time
<p>I use an external source to get the location of users to my website so that i can customize the site for there location however the external source i am using can sometimes be very slow and as such slows my site down i get the external data using <code>cURL</code> and i have implemented a timeout function <code>curl_setopt($ch,CURLOPT_TIMEOUT,1000);</code> but once the timeout has kicked in the page stops loading and half the page is missing.</p>

<p>This is the script is use on my website </p>

<pre><code>$i = 1;
$geoplugin = new geoPlugin();
$geoplugin-&gt;locate();
if(empty($_SESSION['country'])) { 
  $conchk = $geoplugin-&gt;countryName;
  $_SESSION['country'] =  $conchk;
}
else { $conchk = $_SESSION['country']; }
if(empty($conchk)) {$countrygeo = "NULL_CONT";} else {$countrygeo = $conchk;}
//$countrygeo = "Spain";
$country_find = mysql_query("SELECT * FROM country_list 
  WHERE country='$countrygeo' LIMIT 1");
while($row_cou = mysql_fetch_array($country_find)) {
  $rowcov = $row_cou[1];
  //Geo-location default!
  print "&lt;option selected value=\"$rowcov\"&gt;$rowcov&lt;/option&gt;\n";
  $kvar = 1;
}
//finish first while loop!
//if we cant find the geo-country in the list print the whole table!
$country_full_list_print = mysql_query("SELECT * FROM country_list 
  ORDER BY country ASC");
while($row_full = mysql_fetch_array($country_full_list_print)) {
  if( ($row_full[1] == "United Kingdom") &amp;&amp; ($i == 1) &amp;&amp; (empty($kvar)) ) { 
    print "&lt;option selected value=\"$row_full[1]\"&gt;$row_full[1]&lt;/option&gt;\n"; $i++; }   
    //always print uk as default if no results.
elseif ($row_full[1] == $rowcov) {  }
else { 
  print "&lt;option value=\"$row_full[1]\"&gt;$row_full[1]&lt;/option&gt;\n"; } //this is the default print!
} //close while loop and if num_rows less than 1.
</code></pre>

<p>If anyone has any ideas how to stop the $geoplugin but continue loading the page it would be much appreciated.</p>
