Jump to content

Using cURL


slyte33

Recommended Posts

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);

?>
Link to comment
Share on other sites

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.

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.