English 中文(简体)
PHP cUrl mimic weblogin
原标题:PHP cUrl mimic web login

我曾试图自动登录到具体的网页上,但迄今没有成功。

我真的希望能帮助我移动......。

这是标志页的URL:

https://www.cellcom.co.il/login/pages/default.aspx

第一个领域是用户名称,第二个领域是密码。

我先是利用吉大港山区干.头.,但无法记录。

感谢。


I m close to crack this down. I figured out that one POST form field as embed partial value which changes dynamically. so all i need to do is getting this embed partial value and adding some static text to it. to get the complete field value.

How do i get a POST form field value? (I ve seen the value while looking at the form source code)

我也注意到,在变化充满活力的结尾处,情况很小。

这方面的一个例子是:

(1) 现有评价=%2FwEWBQLh6fTmCwLEh%2FPQBQLquryWCwLdkfOzBAKJwsCnBDoiuyJEoeA1mA05RcQwJ0YqLNx4

2)_EVENTVALIDATION=%2FwEWBQLj%2BKPzBgLEh%2FPQBQLquryWCwLdkfOzBAKJwsCnBELoi3vgs%2BqAdCbcwk%2BkyCQwEq30

Does anyone know how to generate this string? Is it related to date or something like this?

增 编

EDIT: all the dynamically values are embedded in the HTTP source file. Is it possible to parse those values in ease using PHP? If so, how?

问题回答

Still no success. I think I m missing some tiny detail.

The POST form:

表格名称=“网上表格”方法=“海报”行动=“default.aspx”id=“aspnetForm”

input type="hiden" name="__SPSCEditMenu" id="__SPSCEditMenu" value="true" / input type="hidden" name="MSOWebPartPage_PostbackSource" id="MSOWebPartPage_PostbackSource" value="" / input type="hidden" name="MSOTlPn_SelectedWpId" id="MSOTlPn_SelectedWpId" value="" /> input type="hidden" name="MSOTlPn_View" id="MSOTlPn_View" value="0" />

input type="hidden" name="MSOTlPn_ShowSettings" id="MSOTlPn_ShowSettings" value="False" /> input type="hidden" name="MSOGallery_SelectedLibrary" id="MSOGallery_SelectedLibrary" value="" /> input type="hidden" name="MSOGallery_FilterString" id="MSOGallery_FilterString" value="" /> input type="hidden" name="MSOTlPn_Button" id="MSOTlPn_Button" value="none" /> input type="hidden" name="__REQUESTDIGEST" id="__REQUESTDIGEST" value="0xFFD5F7BB65113ADA485BE8F57AF640C45348305D1590E21AEF42305F6FB76DAF255DAD98F5110B3065ADAC1AE647B87F1309481C513057EC9C2C9EB5C71770D4,15 Jan 2010 19:29:23 -0000" /> input type="hidden" name="MSOAuthoringConsole_FormContext" id="MSOAuthoringConsole_FormContext" value="" /> input type="hidden" name="MSOAC_EditDuringWorkflow" id="MSOAC_EditDuringWorkflow" value="" /> input type="hidden" name="MSOSPWebPartManager_DisplayModeName" id="MSOSPWebPartManager_DisplayModeName" value="Browse" /> input type="hidden" name="MSOWebPartPage_Shared" id="MSOWebPartPage_Shared" value="" /> input type="hidden" name="MSOLayout_LayoutChanges" id="MSOLayout_LayoutChanges" value="" /> input type="hidden" name="MSOLayout_InDesignMode" id="MSOLayout_InDesignMode" value="" /> input type="hidden" name="MSOSPWebPartManager_OldDisplayModeName" id="MSOSPWebPartManager_OldDisplayModeName" value="Browse" /> input type="hidden" name="MSOSPWebPartManager_StartWebPartEditingName" id="MSOSPWebPartManager_StartWebPartEditingName" value="false" /> input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUBMA9kFgJmD2QWAgIBDxYCH==" />

and this is the code I m using: function http($target, $ref, $method, $data_array, $incl_head) { # Initialize PHP/CURL handle $ch = curl_init();

# HEAD method configuration
if($method == HEAD)
    {
    curl_setopt($ch, CURLOPT_HEADER, TRUE);                // No http head
    curl_setopt($ch, CURLOPT_NOBODY, TRUE);                // Return body
    }
else
    {
    # GET method configuration
    if($method == GET)
        {
        if(isset($query_string))
            $target = $target . "?" . $query_string;
        curl_setopt ($ch, CURLOPT_HTTPGET, TRUE); 
        curl_setopt ($ch, CURLOPT_POST, FALSE); 
        }
    # POST method configuration
    if($method == POST)
        {
        if(isset($data_array))
            curl_setopt ($ch, CURLOPT_POSTFIELDS, $data_array);
        curl_setopt ($ch, CURLOPT_POST, TRUE); 
        curl_setopt ($ch, CURLOPT_HTTPGET, FALSE); 
        }
    curl_setopt($ch, CURLOPT_HEADER, $incl_head);   // Include head as needed
    curl_setopt($ch, CURLOPT_NOBODY, FALSE);        // Return body
    }

curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);   // Cookie management.
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE);
curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT);    // Timeout
curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME);   // Webbot name
curl_setopt($ch, CURLOPT_URL, $target);             // Target site
curl_setopt($ch, CURLOPT_REFERER, $ref);            // Referer value
curl_setopt($ch, CURLOPT_VERBOSE, FALSE);           // Minimize logs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    // No certificate
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);     // Follow redirects
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);             // Limit redirections to four
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);     // Return in string

I m using this URL which I extracted from Live HTPP header for the form: https://www.cellcom.co.il/siteminderagent/forms/login.fcc

what Do u think? does it make sense?





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签