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

Edited by donatastommy
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.