Re: CURL de-bugging: So why am I not getting the results page on the target site?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The way this page works is you access index.asp?SerialNo=abc123 from a link, that is re-directed to a frameset containing the main page, main.asp, just that. main.asp does not have any <input> fields showing the SerialNo, there is a comment with it but that is all. Fom this page, you input some dates and submit, and the form action is on a page like /checkthis.asp. What I can't see is how /checkthis.asp knows the SerialNo, which it needs. Is there some other way that asp pages transfer information between pages? I looked at the cache for IE after each page load and it does not have SerialNo as cookies or any cookies from this site other than google conversion tracking. On main.asp the button that submits the form does not refer to the SerialNo either. Nevertheless the results page creates the relevant data from the database. But it does produce error messages like, The Object has been Moved here, with my site plus ?lngSessionId=234984987&SerialNo=abd123&WinMode=&AgentCode=&CustCode=. If I add these parameters to the target URL in the CURL script it looks for displaymode (the message with my url in the display line at end of browser window: www.mysite.com/displaymode=).
John

ioannes wrote:
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux