Jump to content

PHP cURL - How to tell if I'm successfully logged in?


donatastommy

Recommended Posts

The forum is an IPboard forum.

I am trying to find out if my login is successful. So I login with my credentials and hit submit When I hit submit, all it does is include the other site below the post fields Here is a screenshot before I hit submit:

cecea7aff4947b953ce093f4328722b4.png

 Here is a partial screenshot after I hit submit:

8a03440584c0f9385cb1faef05e11993.png

I tried entering the correct and incorrect credentials and the same thing is happening. I am not sure whether or not my login is successful or not. After I login I am planning to post in a members area.
 
Note: the message post field is not being used right now I will use that for something else, but here is my code:

 

<html>
<div>
<form method="POST">
Message: <input name="message" type="text" size="25" /></br>

Username:<input name="username" type="text" size="25" /></br>

password:<input name="password" type="password" size="25" /></br>

<input name="submit" type="submit" value="submit" />

</form>
</div>
</html>

<?php

if(isset($_POST['message'])){$message= $_POST['message'];}

if(isset($_POST['username'])){$username = $_POST['username'];}
if(isset($_POST['password'])){$password = $_POST['password'];}
if(isset($_POST['submit'])){
$link = "http://site.com/index.php?section=login;
$datatopost = array (
"auth_key" => "880ea6a14ea49e853634fbdc5015a024",
"referer" => "http://google.com",
"ips_username" => $_POST['username'],
"ips_password" => $_POST['password'],
);

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec($ch);
echo $returndata;
curl_close($ch);
};



?>

 

Can someone point me in the right direction? thanks

When you submit the form the remote server will send you something that it can use to identify you by. It you don't catch that data and send it along in your next request then the server will assume that you are not logged in.

 

So you'll have to investigae how the login process works.

 

You should probably also think about what you want to do; if the remove server want's you to be able to automate the posting , wouldn't it have an API?

When you submit the form the remote server will send you something that it can use to identify you by. It you don't catch that data and send it along in your next request then the server will assume that you are not logged in.

 

So you'll have to investigae how the login process works.

 

You should probably also think about what you want to do; if the remove server want's you to be able to automate the posting , wouldn't it have an API?

So you mean like cookies? How would I catch the cookies? They are randomly generated after each logon.

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.