My wife is going nuts trying to get a specific item from TJ Maxx that keeps going in and out of stock. I'm trying to write a simple script that just checks for her, using curl and PHP. Here's the code:
$curl_connection = curl_init();
$url = "https://tjmaxx.tjx.com/store/index.jsp";
curl_setopt($curl_connection, CURLOPT_URL, $url);
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($curl_connection, CURLOPT_COOKIEJAR, 'cookie.txt');//cookiejar to dump cookie infos.
curl_setopt ($curl_connection, CURLOPT_COOKIEFILE, 'cookie.txt');//cookie file for further reference from the site
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_connection, CURLOPT_HEADER, true);
curl_setopt($curl_connection, CURLOPT_REFERER, "https://www.google.com");
$result = curl_exec($curl_connection);
echo $result;
This isn't working, it just sits there until eventually timing out. I am able to successfully pull pages like google or cnn by changing the url. Any idea why TJ Maxx's website would be giving me this trouble?