cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re[6]: Sessions in CURL

From: Vladimir <vladkalmik_at_yahoo.com>
Date: Tue, 12 Jun 2001 17:15:56 +0300

Hello Daniel,

Tuesday, June 12, 2001, 2:48:03 PM, you wrote:

DS> On Tue, 12 Jun 2001, Vladimir wrote:

>> I am trying to send so kind of form and I cannot send it.
>>
>> Something like
>> <form name="Form" method="post"
>> action="index.asp?UserName=something&somedata=somedata">
>> <input type="radio" name="Type" value="Common" onClick="document.Form.submit()">
>> <input type="radio" name="Type" value="Other" onClick="document.Form.submit()">
>>
>> That is all
>> Itry to send from CURLOPT_POSTFIELDS
>> $request="UserName=something&somedata=somedata";

>> But no results. Any thougth???

DS> Of course I have!

DS> The "action" is the URL to use, which in this case tells you to POST to the
DS> url "http:/blablabla/index.asp?UserName=something&somedata=somedata".

DS> The CURLOPT_POSTFIELDS should then contain "Type=Common" or "Type=Other",
DS> depending on which button you want it to look like you're pressing.

I did this, but it is something else
My be the problem is in cookie I received ??
I receive curl_setopt($ch, CURLOPT_COOKIEFILE, "111.txt"); in the
first page
And use the same command to access the second page, But nothing :((.

Here is my code:

$file = fopen("111.txt", "w+");
$ch = curl_init();

$request = "Login=Login&Password=Password&btnLogin=Login";
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt ($ch, CURLOPT_URL, "https://secure.server.com/login.asp");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_WRITEHEADER, $file);
//curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt($ch, CURLOPT_REFERER, "https://secure.server.com/login.asp");
curl_setopt($ch, CURLOPT_COOKIEFILE, "111.txt");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_exec($ch);

!!!!!!
The first page is working fine I get the second page into the Browser
or file it depends of commented rows
!!!!!!

$request="Name=Name&Operand=23236&OperID=16614&Type=Other";

curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_URL, "https://secure.server.com/index.asp");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt($ch, CURLOPT_REFERER, "https://now.wcom.com/login.asp");
curl_setopt($ch, CURLOPT_COOKIEFILE, "111.txt");
curl_exec($ch);
curl_close($ch);

The second part has troubles. ?????

-- 
Best regards,
 Vladimir                            mailto:vladkalmik_at_yahoo.com
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
Curl-and-php mailing list
http://curl.haxx.se/
Received on 2001-06-12