My current theory on this is that the initial input page creates a
per-session cookie. Is CURL able to send this when the page is
submitted and if so how do I find out the name and value of the cookie
as per my reading it is not stored on the computer, though I reckon it
must be there somewhere.
The initial page is in this format:
https://www.targetsite.com/subdir/page.asp?serialno=GM201&OtherCode=&NextCode=
So I have various GET parameters.
The initial input page also has POST parameters which I can see the in
page source, and so send via CURL.
I cannot find any javascript doing a set_cookie, including in any
included files of which there are none anyway. But there is some
session going on as the serialno parameter is not in a hidden field or
explicitly set cookie, so it must be a per-session cookie maybe with a
different name, I reason. How do I find out about these?
John
ioannes wrote:
My code is as below. It comes back with 'Bad session variable name -
CompanySerialNo' from the site.but the COOKIEJAR does not show this
variable name and it is not sent, it just shows:
www.targetsite.com FALSE / FALSE 0
ASPSESSIONIDQCSQDTAB LKAONANAFJPNMFFECLFNCLBP
There is a serialno but that is sent in the GET (URL below). Question
is: What to test now? I am trying to get a results page from an input
page.
What code below is trying to do is access the page, get any cookies
set then try the page again with the relevant inputs.
<?
$url="https://www.targetsite.com/subdir/page.asp?serialno=GM201&OtherCode=&NextCode=";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_URL, $url);
/*
//GET list from submitting POST form as GET
https://www.shortstay-london.com/checkavail.asp?
1 - clock=+09%3A54
2 - &StartDay=6
3 - &StartMonth=September+%3A+2008
4 - &EndDay=13
5 - &EndMonth=September+%3A+2008
....13 - &CheckThis=Check+This
use this list to create POST data
*/
curl_setopt($ch, CURLOPT_POST, 1);
$curlPost=array();
$curlPost["clock"]=" 09:54";
$curlPost["StartDay"]="6";
$curlPost["StartMonth"]="September : 2008";
$curlPost["EndDay"]="13";
$curlPost["EndMonth"]="September : 2008";
//etc
$curlPost["CheckThis"]="Check This";
curl_setopt($ch, CURLOPT_POSTFIELDS,$curlPost);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close ($ch);
print($store);
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php