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
https://forums.phpfreaks.com/topic/282994-using-curl/
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
https://forums.phpfreaks.com/topic/282994-using-curl/#findComment-1454039
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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