Jump to content

Help: http post is not working


mr_zhang

Recommended Posts

Hi,

 

I'm trying to login to delirious via script and I can't. I've tried using CURL and it is also not working. I then try to post manually.

 

It's also still not working. Anybody can help?

 

<html>
<head>
</head>
<body>
<?
$url_info=parse_url('http://de.lirio.us/login/');
$referrer=$_SERVER["SCRIPT_URI"];
$data='username=user&password=pass&keeppass=&query=';
//I've tried with(not working also):
//$data='username=user&password=pass';
$url_info['port']=80;

$request="POST ".$url_info['path']." HTTP/1.1\n";
$request.="Host: ".$url_info["host"]."\n";
$request.="Referer: $referer\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="Content-length: ".strlen($data)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data."\n";

$fp = fsockopen($url_info["host"],$url_info["port"]);
fputs($fp, $request);
while(!feof($fp))
{
//Get Body
$result .= fgets($fp, 8192);
        }//while(!feof($fp))
fclose($fp);
echo $result;
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/
Share on other sites

Give details.

 

Well, as you can see, I'm trying to login by php, not manually by hand. However, the result from fgets() is the login form (not logged in).

 

So, it does get the login page correctly. However, it does not logged in (which I want to do). It seems that the POST action is not sent.

 

Any help?

Thanks Thorpe.

 

After testing it, I still can't logged in. I've tried changing the referer to:

- http://de.lirio.us/login/ (original login form if typed in browser. It's targetting itself.)

- http://de.lirio.us/

 

Both still can't get me in.

 

Any other suggestion?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.