Geoffism00 Posted April 7, 2020 Share Posted April 7, 2020 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_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"); Quote Link to comment https://forums.phpfreaks.com/topic/310495-curl-php-crawler-returns-access-denied-error/ Share on other sites More sharing options...
gw1500se Posted April 7, 2020 Share Posted April 7, 2020 How about making your script readable? Use the code icon (<>) and select PHP. Quote Link to comment https://forums.phpfreaks.com/topic/310495-curl-php-crawler-returns-access-denied-error/#findComment-1576518 Share on other sites More sharing options...
Barand Posted April 7, 2020 Share Posted April 7, 2020 Not surprised, browsed to the page and got put in a holding queue. Quote Link to comment https://forums.phpfreaks.com/topic/310495-curl-php-crawler-returns-access-denied-error/#findComment-1576527 Share on other sites More sharing options...
requinix Posted April 8, 2020 Share Posted April 8, 2020 An Access Denied message suggests they have some sort of system in place to prevent the sort of thing you're doing. Are you sure the website can't help you already? Does adding it to your favorites do anything special? Are the sales you're talking about the sort of thing that would be listed in their weekly ads? Quote Link to comment https://forums.phpfreaks.com/topic/310495-curl-php-crawler-returns-access-denied-error/#findComment-1576546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.