Jump to content

help with php+curl dumpin ASP website


tomasd

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/62840-help-with-phpcurl-dumpin-asp-website/
Share on other sites

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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.