CURL PHP Crawler Returns Access Denied Error

My dad loves these frozen cheeseburgers from meijer so I was gonna write a little script I can run in cron that will check Meijer’s website and txt or email or something if they go on sale.

Whenever I run the below script I get an Access Denied response from the server instead of the html for the cheesburger page.

I’m sure I just need a CURL option or something.

Thank You in Advance

function curl_download($Url)
{
	if (!function_exists('curl_init')){die('cURL is not installed. Install and try again.');}
  
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $Url);
	
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_VERBOSE, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_HEADER, true);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");

	$output = curl_exec($ch);
	curl_close($ch);
  
    	return $output;
}
 
print curl_download("https://www.meijer.com/shop/en/frozen/frozen-meals/sandwiches/meijer-bacon-cheeseburger-4-9-oz/p/71373326278");

Considering I went to that url direct and it still hasn’t loaded, There could be any number of things wrong that have nothing to do directly with you code, but you would need to allow for in the code.

What country are you in? I can not get it to load either.
It appears that the page moves you around to other pages behind the scenes. And, it puts up a delay on the page before it continues to the next page. From what I see so far. It might be a problem with time-outs between the pages when it sends you to a new one. The “FOLLOWLOCATION” should follow it to the final one, but, you might have to add a time-out higher than the standard one.
Here is a link to a discussion on the two possible time-outs. Might help…
StackOverflow-Curl-Timeouts

Sponsor our Newsletter | Privacy Policy | Terms of Service