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

curl-and-php

Re: Login not happenin'

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Thu, 28 May 2009 07:38:52 -0400

It could be that you have to get the new __VIEWSTATE variable each time - I
am not exactly sure why, but I have seen it cause trouble before with others
on this list.
-Stephen

On Wed, May 27, 2009 at 23:50, Deepesh Malviya <deep0mal_at_gmail.com> wrote:

> Hi,
>
> Can you explain what actually you are trying to pass into
> CURLOPT_POSTFIELDS?
>
> Regards,
> Deepesh
>
> On Mon, May 25, 2009 at 11:59 PM, Neagoe Robert <robertneagoe_at_gmail.com>wrote:
>
>> Hello,
>> I need some help, please.
>> I want to login to this site and I wrote this login.php (the code bellow)
>> in many ways, but it just redirects me to the same login page. with no
>> postfields completed.
>> I gave a valid username and password (it's just for test although)
>>
>> <?php
>>
>> $url = "http://investorshub.advfn.com/boards/login.aspx";
>> $ch = curl_init($url);
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>> curl_setopt($ch, CURLOPT_URL, $url);
>> curl_setopt($ch, CURL_FAILONERROR, 1);
>> curl_setopt($ch, CURLOPT_TIMEOUT, 59);
>> curl_setopt($ch, CURLOPT_POST, 1);
>> curl_setopt($ch, CURLOPT_POSTFIELDS,
>> "ctl00_CP1_LoginView1_Login1_LoginButton=".urlencode('Log
>> In')."&ctl00_CP1_LoginView1_Login1_RememberMeCustom=checked&ctl00_CP1_LoginView1_Login1_Password=".urlencode('ghici')."&ctl00_CP1_LoginView1_Login1_UserName=".urlencode('TreborGrant')."&__VIEWSTATE=".urlencode('/wEPDwUKMTc2NDAxMzc4NQ9kFgJmD2QWBAIBD2QWDAIEDxYCHgdWaXNpYmxlaGQCBQ8WAh8AaGQCBg8WAh8AaGQCBw8WAh8AaGQCCA8WAh8AaGQCCQ8WAh8AZ2QCAw9kFgICAQ9kFgICCw8PFgIfAGdkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUsY3RsMDAkQ1AxJExvZ2luVmlldzEkTG9naW4xJFJlbWVtYmVyTWVDdXN0b227zjs+8JqJrSLkUxCgQGAlAAAAAA==')."&__EVENTARGUMENT=&__EVENTTARGET=");
>> //ADD FIELDS AND VALUES
>>
>> //curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
>>
>> $result = curl_exec($ch);
>> echo $result;
>>
>> print_r(curl_getinfo($ch));
>> echo "\n\n cURL error number: ".curl_errno($ch);
>> echo "\n\n cURL error: ".curl_error($ch);
>>
>>
>> curl_close($ch);
>>
>> ?>
>>
>> ==========================
>> The message from the curl_getinfo is:
>>
>> Array
>> (
>> [url] => http://investorshub.advfn.com/boards/login.aspx
>> [content_type] => text/html; charset=utf-8
>> [http_code] => 200
>> [header_size] => 442
>> [request_size] => 685
>> [filetime] => -1
>> [ssl_verify_result] => 0
>> [redirect_count] => 0
>> [total_time] => 0.228932
>> [namelookup_time] => 0.004061
>> [connect_time] => 0.054019
>> [pretransfer_time] => 0.054025
>> [size_upload] => 536
>> [size_download] => 19717
>> [speed_download] => 86126
>> [speed_upload] => 2341
>> [download_content_length] => 19717
>> [upload_content_length] => 0
>> [starttransfer_time] => 0.125973
>> [redirect_time] => 0
>> )
>>
>>
>> cURL error number: 0
>>
>> cURL error:
>>
>>
>> ===================
>> that means: no error, right?
>>
>> So can you please help me with this - 'cause i've been banging my head up
>> for a week now...
>> Will appreciate big time!
>>
>> Kind regards
>>
>> _______________________________________________
>> 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 2009-05-28