Jump to content
ankur218

How to cURL a JSP page

Recommended Posts

I am trying to cURL my university login page. I want users to enter their university id and pass in my website, my website will curl to university website, authenticate and then allow them to login or give error accordingly. But my university portal is a jsp page. And after having posted in StackOverflow and other forums before, this is what I came up with. I need further help on where I am going wrong and how to rectify it.

<form class="form-horizontal" action="curl.php" method="POST">	    <div class="control-group">		    <label class="control-label" for="inputEmail">Username</label>		    <div class="controls">			    <input type="text" id="inputEmail" placeholder="Username">		    </div>	    </div>	    <div class="control-group">		    <label class="control-label" for="inputPassword">Password</label>		    <div class="controls">			    <input type="password" id="inputPassword" placeholder="Password">		    </div>	    </div>	    <div class="control-group">		    <div class="controls">			    <label class="checkbox">				    <input type="checkbox"> Remember me			    </label>			    <button type="submit" class="btn">Sign in</button>		    </div>	    </div>    </form>

Now this is my curl.php file:

<?php    $address = "http://evarsity.srmuniv.ac.in/srmswi/usermanager/youLogin.jsp"; //site URL    $post = "username=txtRegNumber&pass=txtPwd"; //Parameters to be sent. Written like GET.    $welcomeMessage = "Welcome..."; //This is the message that is displayed when a login is successful    $options = array(	   CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)',	   CURLOPT_POST => true, //using post	   CURLOPT_URL => $address,  //where to go	   CURLOPT_POSTFIELDS => $post, //input params	   CURLOPT_RETURNTRANSFER => true, //Returns a string value of the request	   CURLOPT_SSL_VERIFYPEER => false, //Avoid SSL problems	   CURLOPT_COOKIEFILE => 'cookie.txt', //Save cookies	   CURLOPT_COOKIEJAR => 'cookies.txt' //Cookies located	   CURLOPT_USERPWD ==> [username]:[password]);		  if (strpos($content, $welcomeMessage) !== false){		  /*		  Do whatever,I don't know what to do here though		  */		  }	  curl_close($ch); //close connections    ?>

Please let me know where I am going wrong, why I am not able to login and after logging in, how to log out.Thank you.

Share this post


Link to post
Share on other sites

doesn't look like you've done anything since already posting this question before and being given suggestionshttp://w3schools.invisionzone.com/index.php?showtopic=45513 i.e. there's no need to double post.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...