title: Get response URL using PHP / cURL very slow
body: <p>Am trying to figure out what method to use here.</p>
  
  <p>Am trying to write some php to query a servlet and get the redirect URL / response ONLY.</p>
  
  <p>For example - going to this URL / servlet request  <a href="http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockCmd?partNum=5240793&amp;storeSelection=4101" rel="nofollow">http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockCmd?partNum=5240793&amp;storeSelection=4101</a> will redirect to the following URL / servlet response instantly: <a href="http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockResultView?query-result=13&amp;pickupStoreNumber2=826&amp;pickupStore=Arklow&amp;storeStockStatus=0&amp;availableQuantityInStore2=1&amp;storeStockStatus2=1&amp;outOfStockEmail=&amp;pickupStore2=Wexford&amp;failureView=CheckPriceAndStockResultView&amp;partNum=5240793&amp;isExtraStoreRequest=0&amp;promisedAvailTime2=2011-09-19&amp;pickupStoreType=3&amp;availableQuantityInStore=0&amp;storeSelection=4101&amp;pickupStoreNumber=4101&amp;stockChecked=true&amp;pickupStoreType2=3&amp;promisedAvailTime=&amp;estAvailTime=&amp;catentryid=95934&amp;estAvailTime2=&amp;ddkey=http:CheckPriceAndStockCmd" rel="nofollow">http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockResultView?query-result=13&amp;pickupStoreNumber2=826&amp;pickupStore=Arklow&amp;storeStockStatus=0&amp;availableQuantityInStore2=1&amp;storeStockStatus2=1&amp;outOfStockEmail=&amp;pickupStore2=Wexford&amp;failureView=CheckPriceAndStockResultView&amp;partNum=5240793&amp;isExtraStoreRequest=0&amp;promisedAvailTime2=2011-09-19&amp;pickupStoreType=3&amp;availableQuantityInStore=0&amp;storeSelection=4101&amp;pickupStoreNumber=4101&amp;stockChecked=true&amp;pickupStoreType2=3&amp;promisedAvailTime=&amp;estAvailTime=&amp;catentryid=95934&amp;estAvailTime2=&amp;ddkey=http:CheckPriceAndStockCmd</a></p>
  
  <p>I want to basically get that response and some of the parameters in it (I can do the latter).</p>
  
  <p>Have tried using various cURL methods to output headers and / or get final redirect URL but they're either not useful or very slow:</p>
  
  <pre><code>$url = "http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockCmd?partNum=" . $catNum . "&amp;storeSelection=" . $storeNum;
  
  $ch = curl_init();
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_URL, $url);
  curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
  curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
  
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_NOBODY, true);
  
  $content = curl_exec ($ch);
  curl_close ($ch);
  </code></pre>
  
  <p>Anyone got any suggestions?</p>