Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cURL request on a page requiring JavaScript support

I need to get the HTML source of pinnaclesports.com. The problem is it detects whether cookies and JS are enabled and if not, it just returns some page saying

This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser.

Is there any way how to spoof JS support when using cURL?

EDIT: I can use a headless browser that runs either as a Perl/Ruby module or is written in PHP

like image 645
user965748 Avatar asked Sep 06 '12 15:09

user965748


People also ask

Does curl support Javascript?

Wget and curl don't handle javascript. Your question makes no sense. The web uses HTTP as a universal protocol for client-server web transactions. The server and the client are independent objects/ entities that can exchange data because of HTTP.

How do you call a curl in Javascript?

To make a GET request using Curl, run the curl command followed by the target URL. Curl automatically selects the HTTP GET request method unless you use the -X, --request, or -d command-line option.

How do I get my browser to request a curl?

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.

What is a curl request?

'cURL' is a command-line tool that lets you transmit HTTP requests and receive responses from the command line or a shell script.


1 Answers

Other sugestion is set the user agent, this solution works for me on parser of the Google Groups:

curl -L -v "https://groups.google.com/d/forum/<GROUP-NAME>" -A "Mozilla/5.0 (compatible;  MSIE 7.01; Windows NT 5.0)"
like image 168
João Paulo Cercal Avatar answered Sep 21 '22 15:09

João Paulo Cercal