zer has asked for the wisdom of the Perl Monks concerning the following question:
I am attempting to communicate directly to a server to test ajax responses. I have attempted using mozilla::mechanize and selenium however due to errors they dont run.
I need to mimic the following post with variations to the url. I am using WWW::Mechanize as it handles the cookies and other interactions that i am doing very well.
Http Header Capture
http://[ADDRESS]/fbjs_ajax_proxy.php POST /fbjs_ajax_proxy.php HTTP/1.1 Host: [ADDRESS] User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:220.127.116.11) Gecko +/20071204 Ubuntu/7.10 (gutsy) Firefox/18.104.22.168 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 +,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Referer: http://[ADDRESS]/Profile.php?uid=[IDNUM] Content-Length: 889 Cookie: c_user=227302802; sid=2; __utma=87286159.462992557.1198733524. +1198820048.1198836479.9; xs=99ba8adfbde7929b813ade803a0b797f; G6X9=2- +2-061F577DD020161F5618F04BC46C536DA6F6D020489A14211B78600B73C43527-F3 +A883B35D6CD6D9F582182CF2FB69666221D9F5D2BE2BD79EAA2E5A389C58A5; login +_x=227302802; __utmz=87286159.1198836479.9.8.utmccn=(referral)|utmcsr +=senecac.facebook.com|utmcct=/profile.php|utmcmd=referral; made_write +_conn=1198836470; isfbe=false; __utmb=87286159; __utmc=87286159 Pragma: no-cache Cache-Control: no-cache url=http%3A%2F%2F[IP ADDRESS]%2FpostComments.php%3Fuid%3D227302802%26h +erd%3D&query%5Bcomment%5D=text%20messages%20are%20cool&query%5Bcomman +d%5D=&post_form_id=134f8cf869f0852535eb9c362517960b&type=2&require_lo +gin=true&fb_mockajax_context=O%3A16%3A%22CanvasFBMLFlavor%22%3A1%3A%7 +Bs%3A9%3A%22_fbml_env%22%3Ba%3A8%3A%7Bs%3A4%3A%22user%22%3Bi%3A227302 +802%3Bs%3A6%3A%22app_id%22%3Bs%3A10%3A%222437228683%22%3Bs%3A10%3A%22 +fb_page_id%22%3Bi%3A0%3Bs%3A14%3A%22unfiltered_css%22%3Bb%3A0%3Bs%3A1 +0%3A%22canvas_url%22%3Bs%3A66%3A%22http%3A%2F%2F[reffered url]%2FProf +ile.php%3Fuid%3D[IDNUM]%22%3Bs%3A10%3A%22source_url%22%3Bs%3A70%3A%22 +http%3A%2F%2F[IP ADDRESS]%2FProfile.php%3Fuid%3D[IDNUM]%22%3Bs%3A9%3A +%22loggedout%22%3Bb%3A0%3Bs%3A7%3A%22non-tos%22%3Bb%3A0%3B%7D%7D&fb_m +ockajax_context_hash=f1247ab4b99b&appid=2437228683
I was looking at LWP::UserAgent as it is a part of the WWW::Mechanize->request(). Is this possible? The documentation doesn't touch on this in the ways id like it to. Any guidance would be awsome, especially examples (like with the header i provided)
Thank you for reading and to those who help!