CodeIgniter Forums
CURL error: The requested URL returned error: 403 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: CURL error: The requested URL returned error: 403 (/showthread.php?tid=79147)



CURL error: The requested URL returned error: 403 - ciddict - 04-29-2021

It's my code to send curl:

PHP Code:
$data = array(
    "foo" => "bar"
);

$curl_options = array(
    'query' => $data,
    'timeout' => 1,
    "user_agent" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
);

$client = \Config\Services::curlrequest();

$client->request('PUT'"https://myownsite.com/index.php/receive_curl/receive"$curl_options); 

It's giving this error:


Quote:22 : The requested URL returned error: 403


Did I missed any required option in my code?


RE: CURL error: The requested URL returned error: 403 - iRedds - 04-29-2021

https://en.wikipedia.org/wiki/HTTP_403


RE: CURL error: The requested URL returned error: 403 - romankris - 08-14-2022

This error indicates that the server has determined that you are not allowed access to the thing you've requested, either on purpose or due to a misconfiguration . It's probably because the site owner has limited access to it and you don't have permission to view it. The vast majority of the time, there's not much you can do to fix things on your (*client) end. There are four common causes for 403 Forbidden error (server side) . Here they are listed from most likely to least likely:
  • An empty website directory
  • No index page
  • Incorrect settings in the .htaccess file
  • Permission / Ownership error

If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.