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

curl-and-php

Re: Help for login whith Https

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Mon, 1 Sep 2008 17:36:59 -0400

In Login.aspx, here are the relevant parts of your form:
<form name="Form1" method="post" action="Login.aspx" id="Form1"
autocomplete="off">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwULLTE2NDczNzY0MDRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBQ5ja2JTYWx2YXJFbWFpbNB9hVyuIwlSPQtV+xmG3zBqhrAG"
/>
<input name="Email" type="text" maxlength="255" id="Email" tabindex="1"
class="CampoForm" style="width:140px;" /></td>
<input name="txtSenha" type="password" maxlength="255" id="txtSenha"
tabindex="2" class="CampoForm" style="width:140px;" /></td>
<input id="ckbSalvarEmail" type="checkbox" name="ckbSalvarEmail"
tabindex="3" />
<input type="submit" name="btnLogin" value="Entrar" id="btnLogin"
tabindex="4" style="width:80px;" /></td>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWBQL3yv6DDwKS18aDDQLxiYiEAQK71KLFDwKC3IeGDPn7gJXPvX2ZZ3Epvbx6LU1PbOxY"
/>
</form>

My guess is that since you're only posting these fields:
$POSTFIELDS = 'Email='.$id.'&txtSenha='.$password.'&btnLogin=Entrar';
The server also needs the fields like VIEWSTATE and _EVENTVALIDATION filled
out. I'm not sure if those are variable or constant, as I'm not familiar
with ASP .NET.

-Stephen

On Mon, Sep 1, 2008 at 8:40 AM, Michael Horowitz <
michael_at_yourcomputerconsultant.com> wrote:

> What error are you getting?
>
> I would also suggest you verify the user id and password you have is
> correct. Sometimes it can be something as simple as that.
>
> I would also check the receiving servers log to see what response they are
> giving when they receive your post?
>
> Michael Horowitz
> Your Computer Consultant
> http://yourcomputerconsultant.com
> 561-394-9079
>
>
>
> Lucas eu?! wrote:
>
>> Hello,
>>
>> Thanks, but unfortunatelly it didn't work. Please, is there any soluction?
>>
>>
>>
>> Date: Sun, 31 Aug 2008 15:46:36 -0400
>> From: Michael Horowitz <michael_at_yourcomputerconsultant.com <mailto:
>> michael_at_yourcomputerconsultant.com>>
>> Subject: Re: Help for login whith Https
>> To: curl with PHP <curl-and-php_at_cool.haxx.se <mailto:
>> curl-and-php_at_cool.haxx.se>>
>> Message-ID: <48BAF51C.2030402_at_yourcomputerconsultant.com <mailto:
>> 48BAF51C.2030402_at_yourcomputerconsultant.com>>
>> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>>
>> The way I have sent a user id and password is
>>
>> curl_setopt($ch, CURLOPT_USERPWD, 'userid:password');
>>
>> Michael Horowitz
>> Your Computer Consultant
>> http://yourcomputerconsultant.com <http://yourcomputerconsultant.com/>
>>
>> 561-394-9079
>>
>>
>>
>> Lucas eu?! wrote:
>> > Hello!
>> >
>> > My code is:
>> >
>> > <?
>> >
>> > $id = "xxxxxx";
>> > $password = "xxxxxx";
>> > $cookie_file_path = "cookiejar.txt";
>> > $loginURL = "https://pagseguro.uol.com.br/Default.aspx";
>> > $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
>> > Gecko/20030624 Netscape/7.1 (ax)";
>> > $POSTFIELDS = 'Email='.$id.'&txtSenha='.$
>> password.'&btnLogin=Entrar';
>> >
>> > $ch = curl_init();
>> > curl_setopt($ch, CURLOPT_URL,$loginURL);
>> > curl_setopt($ch, curlOPT_SSL_VERIFYHOST, 2);
>> > curl_setopt($ch, CURLOPT_HEADER, 1);
>> > curl_setopt($ch, curlOPT_USERAGENT, $agent);
>> > curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
>> >
>> > curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
>> > curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
>> > curl_setopt($ch, curlOPT_SSL_VERIFYPEER, FALSE); // this line makes it
>> > work under https
>> >
>> > $result=curl_exec($ch);
>> >
>> >
>> >
>> > $temparr = explode("id=\"__VIEWSTATE\" value=\"",$result);
>> > $__VIEWSTATE = explode("\" />",$temparr[1]);
>> >
>> > $temparr2 = explode("id=\"__EVENTVALIDATION\" value=\"",$result);
>> > $__EVENTVALIDATION = explode("\" />",$temparr2[1]);
>> >
>> >
>> > $POSTFIELDS =
>> >
>> 'Lili1_OffsetY=0&Lili1_OffsetX=0&ckbSalvarEmail=on&Email='.$id.'&txtSenha='.$password.'&btnLogin=Entrar&__VIEWSTATE='.$__VIEWSTATE[0].'&__EVENTVALIDATION='.$__EVENTVALIDATION[0];
>> >
>> >
>> >
>> >
>> > curl_setopt($ch, CURLOPT_URL,$loginURL);
>> > curl_setopt ($ch, CURLOPT_POST, TRUE );
>> > curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
>> > curl_setopt($ch, CURLOPT_HEADER, false);
>> > curl_setopt($ch, CURLOPT_TIMEOUT, 30);
>> > curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
>> > curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
>> >
>> >
>> > $result=curl_exec($ch);
>> >
>> >
>> > curl_close ($ch);
>> >
>> >
>> > echo($result);
>> > die();
>> > ?>
>> >
>> > See result on http://www.agentesite.com.br/curl/curl_pagseguro.php ;
>> >
>> >
>> > Server Error in '/' Application.
>> >
>> >
>> > I need login in https://pagseguro.uol.com.br/Login.aspx , for test
>> > login use login = noisae_at_hotmail.com <mailto:noisae_at_hotmail.com>
>> <mailto:noisae_at_hotmail.com <mailto:noisae_at_hotmail.com>> and
>> > pass = test123
>> >
>> > Please i need help !! ...
>> >
>> > Thank's!!!!!
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-09-01