tomasd Posted August 1, 2007 Share Posted August 1, 2007 Hi, I'm trying to emulate browser request to one of the budget airlines to get ticket prices from $HOME to $DEST for ($i = 1; $i < $days_for; $i++) I have done this successfully with an airline using .cgi scripting, another airline I'm trying to dump data from is using .asp. What I was able to retrieve from the request I make with my browser is the following: <b>http.request.method</b> = Request Method: POST <b>http.request.uri</b> = Request URI: /en/book/step1.asp <b>http.request.version</b> = Request Version: HTTP/1.1 <b>http.cookie</b> = Cookie: eJ_orig=LGW; eJ_orig_perm=*LO; eJ_dest=MJV; ASPSESSIONIDCAACDDQB=CHDFNHEADFFJHKKIHFBKHNIO; ASPSESSIONIDCSSSBCBR=LCBPMAEAIKDCGAAPBCFAIIDP\r\n <b>Post fields:</b> __step=1& __action=goto& __goto=step2.asp& txtorigID=*LO&txtdestID=& txtdorig=&txtddest=& url=%2Fpage%2FappXML%2Furl& numOfPax=1& __STATEDATA=MGoGCSsGAQQBgjdYA6BdMFsGCisGAQQBgjdYAwGgTTBLAgMCAAECAmYDAgIAwAQI%7CUxqZDd4P9zwEEAwTTUtHJN4M9TSSN9HoJ7QEIBwH6AAIrvcm%2BxwYJzzuz82NFqTE%7CalfR0I8mVkyoCKb6%7C& orig=LGW& dest=MJV& oDay=01& oMonYear=082007& rDay=00& rMonYear=00& numOfAdults=1& numOfKids=0& numOfInfants=0& btn_submitForm=Show+flights%21 I have tried using following code: <?php // curl.php $ch = curl_init(); $url = "http://www.***.com/en/book/step1.asp"; $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $post[__step] = "1"; $post[__action] = "goto"; $post[__goto] = "step2.asp"; $post[numOfPax] = "1"; $post[orig] = "LGW"; $post[dest] = "MJV"; $post[oDay] = "12"; $post[oMonYear] = "092007"; $post[rDay] = "00"; $post[rMonYear] = "00"; $post[numOfAdults] = "1"; $post[numOfKids] = "0"; $post[numOfInfants] = "0"; $post[btn_submitForm] = "Show+flights%21"; /* curl set options */ curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_COOKIE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); /* exec curl */ $data = curl_exec ($ch); /* end curl session */ curl_close($ch); echo $data; //print_r ($post); ?> But with no success. Has anybody had any joy getting data from ASP pages using curl? Quote Link to comment https://forums.phpfreaks.com/topic/62840-help-with-phpcurl-dumpin-asp-website/ Share on other sites More sharing options...
trq Posted August 1, 2007 Share Posted August 1, 2007 You might at least try making your array keys valid syntax.x $post['__step'] = "1"; $post['__action'] = "goto"; $post['__goto'] = "step2.asp"; $post['numOfPax'] = "1"; $post['orig'] = "LGW"; $post['dest'] = "MJV"; $post['oDay'] = "12"; $post['oMonYear'] = "092007"; $post['rDay'] = "00"; $post['rMonYear'] = "00"; $post['numOfAdults'] = "1"; $post['numOfKids'] = "0"; $post['numOfInfants'] = "0"; $post['btn_submitForm'] = "Show+flights%21"; Quote Link to comment https://forums.phpfreaks.com/topic/62840-help-with-phpcurl-dumpin-asp-website/#findComment-313006 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.