I have a php page that curl the following address. it retrieve the page run some xpath queries and returns / echos the results.
When i access this page through the browser it works fine no error is being displayed and the results are being returned.
However when i try to access this page through ajax nothing returns to ajax and it seems like it somewhat stuck.
the flow of event is: i do ajax call to my php page. In that page i do the crul and xpath query and the results are being returned to ajax.
This is the page i try to retrieve.
http://www.zara.com/webapp/wcs/stores/servlet/product/us/en/zara-us-W2012-s/337006/908067/FANTASY%20MINI%20SKIRT%20WITH%20DIAMANTE
Whats weird is php doesn't through any error I've set error_reporting (-1);
to show all errors just incase and still Nothing
here is how i do the curl call:
$url = 'http://www.zara.com/webapp/wcs/stores/servlet/product/us/en/zara-us-W2012-s/337006/908067/FANTASY%20MINI%20SKIRT%20WITH%20DIAMANTE';
$pageData = curl_init($url);
$userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13";
curl_setopt($pageData, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($pageData, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($pageData, CURLOPT_USERAGENT, $userAgent);
// - update
// echo "notification";
// exit;
//
echo $to_return = curl_exec($pageData);
This is the ajax call:
var ajax_url = 'http://www.somedomain.com/f/ajax_func.php';
var url_to_search = 'http://www.zara.com/webapp/wcs/stores/servlet/product/us/en/zara-us-W2012-s/337006/908067/FANTASY%20MINI%20SKIRT%20WITH%20DIAMANTE';
$.ajax({
type: "POST",
url: ajax_url,
data: { ajax_search_product: "ajax", url_to_search: url_to_search}
}).success(function(data) {
alert(data);
})
Am i missing soemthing ? this is really awkward how comes in php it works but as ajax it causes an unexplained error