Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cURL does not work but same site works with browser

what are the reasons for when using cURL form linux server to access the site return an error. but opening this site in chrome succeeds.

like image 748
john Avatar asked Jul 02 '16 12:07

john


People also ask

Why won't curl download this link when a browser will?

There are many HTTP/HTTPS links that require certain headers in order to work. So this will result in a working response from a web browser but not a working response in a backend web request like curl.

Does curl work on HTTP?

At the most fundamental, cURL lets you talk to a server by specifying the location (in the form of a URL) and the data you want to send. cURL supports several different protocols, including HTTP and HTTPS, and runs on almost every platform.

Does curl use browser?

Curl is commonly considered a non-interactive web browser. That means it's able to pull information from the internet and display it in your terminal or save it to a file.

How do I run a curl command in Chrome?

From Chrome and Edge On the line of the specific resource you are interested in, you right-click with the mouse and you select "Copy as cURL" and it will generate a command line for you in your clipboard. Paste that in a shell to get a curl command line that makes the transfer.


1 Answers

Look browsers headers while sending your request, and add same headers to cURL request. Some servers needs some headers that browsers sends default but not cURL.

like image 191
tanaydin Avatar answered Sep 21 '22 23:09

tanaydin