John Davidson

Getting curl response from CLI but access denied from PHP

0 comments
Message:


For many requests I am getting access denied errors when using curl from php, my code is:


    $ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_URL, 'https://www.vueling.com/en');
curl_setopt($ch, CURLOPT_TIMEOUT, '2');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$data = curl_exec($ch);
curl_close($ch);
echo $data;

which returns this:


<H1>Access Denied</H1>

However if I run it directly on the command line:


curl -v https://www.vueling.com/en

I get the full response, my ip is not blocked, im not sure why CLI works but PHP doesnt? Anyone have any ideas?



My Answer:
Access Denied

You don't have permission to access "http://www.vueling.com/en" on this server.

Reference #18.4d2b3417.1635823456.1a2b3c4d

Rate this post

4 of 5 based on 4494 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us