Get response URL using PHP / cURL very slow
Am trying to figure out what method to use here.
Am trying to write some php to query a servlet and get the redirect URL / response ONLY.
For example - going to this URL / servlet request http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockCmd?partNum=5240793&storeSelection=4101 will redirect to the following URL / servlet response instantly: http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockResultView?query-result=13&pickupStoreNumber2=826&pickupStore=Arklow&storeSt开发者_如何学GoockStatus=0&availableQuantityInStore2=1&storeStockStatus2=1&outOfStockEmail=&pickupStore2=Wexford&failureView=CheckPriceAndStockResultView&partNum=5240793&isExtraStoreRequest=0&promisedAvailTime2=2011-09-19&pickupStoreType=3&availableQuantityInStore=0&storeSelection=4101&pickupStoreNumber=4101&stockChecked=true&pickupStoreType2=3&promisedAvailTime=&estAvailTime=&catentryid=95934&estAvailTime2=&ddkey=http:CheckPriceAndStockCmd
I want to basically get that response and some of the parameters in it (I can do the latter).
Have tried using various cURL methods to output headers and / or get final redirect URL but they're either not useful or very slow:
$url = "http://www.argos.ie/webapp/wcs/stores/servlet/CheckPriceAndStockCmd?partNum=" . $catNum . "&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);
Anyone got any suggestions?
精彩评论