0

我正在尝试 curl 登录到此站点:http ://downitfaster.com/但我什至不能说我快要这样做了。

我的代码:

$data = $this->curl("http://downitfaster.com/api/login.php","","textLogin=".$user."&textPassword=".$pass."&btnLogin=submit");

$data = $this->lib->curl("http://downitfaster.com/api/login.php", "textLogin={$user}&textPassword={$pass}&op=submit");

这是表单代码:

<form class="navbar-form pull-right" onsubmit="return false;" style="padding-bottom: 15px;">
                <div style="margin-top: 5px;">

                      <input id="textLogin" type="text" class="input-medium" style="height: 17px; font-size: 12px; margin-top: 5px;" placeholder="Username">
                      <input id="textPassword" type="password" class="input-medium" style="height: 17px; font-size: 12px; margin-top: 5px;" placeholder="Password">
                      <button id="btnLogin" type="submit" class="btn btn-small btn-link" data-loading-text="Loading..." style="margin-top:3px; color: #ffffff; background-color: #2C7FA8; ">Sign In</button>
                      <button id="btnSignup" type="button" class="btn btn-small btn-link" style="margin-top:3px; color: #ffffff; background-color: #C06C56; ">Sign Up</button>
                </div>
                <div style="float: right; margin-top: 2px;"><a href="#" style="color: #fff; font-size: 12px;" id="btnReminder">I forgot my password</a></div>
           </form>

提前致谢

4

1 回答 1

0

像这样的东西?

$urltopost = "http://downitfaster.com/api/login.php";
$datatopost = array (
"login" => "user",
"password" => "pass"
);

$ch = curl_init ($urltopost);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec ($ch);
于 2013-09-22T12:20:03.107 回答