jeudi 1 octobre 2015

Curl working on localhost but not through AWS external service. Getting 403 Forbidden Request

I am trying to do a simple curl request to the website "www.houzz.com".

$url="http://www.houzz.com/";
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch,CURLOPT_TIMEOUT,5);

The code worked perfectly on my localhost machine however now that I switched to AWS it does not seem to be working with my EC2 instance. The page now loads:

"403 Forbidden. Request forbidden by administrative rules."

It worked two times when I launched a new beanstalk application, however most of the times it did not making me think it had something to do with the IP? Any help would be appreciated.




Aucun commentaire:

Enregistrer un commentaire