How to collect data from a website using AJAX with Perl?

This may seem a bit back, but I want to use Perl (and Curl, if possible) to get data from a site using Ajax to populate the HTML shell with the information. How to make these Javascript calls to get the data I need?

The website is here: http://www.jigsaw.com/showContactUpdateTab.xhtml?companyId=224230

+5
source share
2 answers

Remember that AJAX calls are regular HTTP requests, so you should always make them.

Open Firebug or Web Inspector on the website you are talking about, you will see some XHR calls:

XHR : "http://www.jigsaw.com/dwr/interface/UserActionAPI.js".   "Http://www.jigsaw.com/dwr/call/plaincall/UserActionAPI.getMostPurchasedContacts.dwr".   "http://www.jigsaw.com/dwr/call/plaincall/UserActionAPI.getRecentlyGraveyardedContacts.dwr" Http://www.jigsaw.com/dwr/call/plaincall/UserActionAPI.getRecentlyAddedContacts.dwr "." Http://www.jigsaw.com/dwr/call/plaincall/UserActionAPI.getRecentlyTitleChangedContacts.dwr"

! , . HTTP- POST URL-, , , .

(, Web Inspector) AJAX POST, :

"CallCount = 1 =/showContactUpdateTab.xhtml? CompanyID = 224230 httpSessionId = F5E7EC4A45DFCE87B969A9F4FA06C361 scriptSessionId = D020EFF4333283B907402687182D03E034 0-SCRIPTNAME = UserActionAPI 0- = getRecentlyGraveyardedContacts 0-ID = 0 0-param0 = : 224230 0-param1 = 0-param2 = batchId = 1"

, , . , JavaScript, .

+4

, AJAX. X-Requested-With: XMLHttpRequest. :

curl -H 'X-Requested-With: XMLHttpRequest' ...

use HTTP::Request::Common;
GET $url, 'X-Requested-With' => 'XMLHttpRequest', ...

, , , , cookie ( ), nonce, . Firebug .. .

+2

All Articles