使用代理时登录网站

时间:2013-12-12 19:37:29

标签: html forms cookies login proxy

所以我使用php从file_get_contents的URL检索页面HTML。该网站加载正常和一切,但登录字段不起作用。无论如何使用这种方法登录?

不知道它有用,但这是登录表单。

<form class="login-panel async-form" method="post">    
        <div class="yui3-g">
            <label class="email yui3-u-1-2">
                <input
                    type="text" id="email" name="email" value=""
                    placeholder="E-mail &#x2F; Account Name" autofocus required />
            </label>

            <label class="password yui3-u-1-2">
                <input
                    type="password" id="password" name="password" value=""
                    placeholder="Password" required />
            </label>
            <br />

            <a class="login-reset yui3-u" href="https://yummmmmm-c9-veloncia.c9.io/plawy.php?id=&#x2F;recovery">
                Forgot your password?
            </a>



            <button type="submit" class="yui3-button yui3-u">
                Sign in
            </button>
        </div>
    </form>

1 个答案:

答案 0 :(得分:0)

所以你的问题似乎有点不清楚,但可以理解。使用php检索代理数据时,使用CURL而不是file_get_contents

      $url        = "http://randomplacedd.com/url-to-post-data-to";
$postfields = "var1=data&var2=data";
$password   = "password"

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $password);   
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$response = curl_exec($ch);

echo $response;

这样您的代理将检索数据

注意:如果您希望将所有CURL更改为file_get_contents,但我强烈建议您使用CURL