donatastommy Posted September 23, 2013 Share Posted September 23, 2013 (edited) 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: Here is a partial screenshot after I hit submit: 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 September 23, 2013 by donatastommy Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/ Share on other sites More sharing options...
jazzman1 Posted September 23, 2013 Share Posted September 23, 2013 (edited) I'm not using cURL in php, but try to set if (curl_errno($returndata)) Edited September 23, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1450898 Share on other sites More sharing options...
vinny42 Posted September 23, 2013 Share Posted September 23, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1450909 Share on other sites More sharing options...
donatastommy Posted September 23, 2013 Author Share Posted September 23, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1450928 Share on other sites More sharing options...
jazzman1 Posted September 24, 2013 Share Posted September 24, 2013 How the users know if they successfully logged or failed? Is there some message coming from the server to them? Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1450971 Share on other sites More sharing options...
vinny42 Posted September 24, 2013 Share Posted September 24, 2013 So you mean like cookies? How would I catch the cookies? They are randomly generated after each logon. Cookies are most likely yes. Check the cURL manual, if anything can do it, it's cURL. Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1450981 Share on other sites More sharing options...
donatastommy Posted September 28, 2013 Author Share Posted September 28, 2013 Cookies are most likely yes. Check the cURL manual, if anything can do it, it's cURL. Sorry I've been away for a while so you mean like a cookie jar? Quote Link to comment https://forums.phpfreaks.com/topic/282390-php-curl-how-to-tell-if-im-successfully-logged-in/#findComment-1451497 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.