slyte33 Posted October 15, 2013 Share Posted October 15, 2013 I am trying to make a username availability checker on my website for the game runescape to see if a username is in use or not. The link to get the result is https://secure.runescape.com/m=displaynames/c=tjl0oh6Ehhs/check_name.ws?displayname=name If you click it, you'll notice you can't access the page without being logged in first. I'm trying to use curl to log the account in + get the session key (c=tjl0oh6Ehhs) because it's needed for the name checker page. I can't seem to figure out how to do this..here's my code though. Notice I haven't attempted to store the session key because I can't even get it to login yet :\ <?php $username = 'username'; $password = 'password'; $feedUrl = 'https://secure.runescape.com/m=weblogin/loginform.ws?mod=www&ssl=1'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 30 ); curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0'); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $feedContent = curl_exec ($curl); curl_close ($curl); ?> Quote Link to comment Share on other sites More sharing options...
.josh Posted October 15, 2013 Share Posted October 15, 2013 considering there's login involved, you probably need to handle cookies. Look at the various cookie settings in curl_setopt Quote Link to comment Share on other sites More sharing options...
slyte33 Posted October 15, 2013 Author Share Posted October 15, 2013 I managed to get the login working & returning the right results. All I need now is how to get that session c=#. I checked my cookies, there is no session with the same session I have. I don't think it's a cookie.. i think it's just a validator to make sure you can't change their links or something. If you change the key in anyway it'll return to login screen + reset the key, no going back. Quote Link to comment Share on other sites More sharing options...
.josh Posted October 15, 2013 Share Posted October 15, 2013 so where is this "session c=#" normally found when you go to it in your browser? Is it in the response url? on the page somewhere in a div tag or something? Quote Link to comment 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.