远程登录不使用Curl [英] Remote Login not Working With Curl

查看:154
本文介绍了远程登录不使用Curl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有远程登录代码,尝试连接到我的目标网站,但我不能。

hi i have remote login code and try connect to my Target site but i cant .

$url="http://hipfile.com"; 

$postdata = "login=bnnoor&password=########&op=login";

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 

if (!$result) { 
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
        curl_close($ch); // make sure we closeany current curl sessions 
        die($http_code.' Unable to connect to server. Please come back later.'); 
    } 
echo $result;  
curl_close($ch);

并且网站登录表单是

    <form method="POST" action="http://hipfile.com/" name="FL">

<input type="hidden" name="op" value="login">
<input type="hidden" name="redirect" value="http://hipfile.com/">
<div class="clear span-5">Username:&nbsp;<input type="text" name="login" value="bnnoor" class="myForm"></div>
Password:&nbsp;<input type="password" name="password" class="myForm">
<input type="image" style="height: 34px; padding-left:10px; padding-bottom: 3px; vertical-align: middle;" src="http://hipfile.com/images/login.png">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hipfile.com/?op=forgot_pass">Forgot your password?</a><br>

</form>

但我不能访问我的文件在网站和开始页面重定向到网站的登录页面后?
plz帮助我。

but i cant access my file in site and after start page redirect to login page in site? plz help me .

推荐答案

A。网址无效

您使用 http://hipfile.com ,会传回 HTTP /1.1 500 - 错误响应

您需要使用的是(注意 / 结尾处)

What you need to use is (Note the / at the end )

 $url = "http://hipfile.com/" ;

B。参照网址无效

您还需要将 CURLOPT_REFERER 更改为 http://hipfile.com /login.html

这篇关于远程登录不使用Curl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆