SwiftIRC
IRC Discussion and Support
 
  Index  •  FAQ  •  Search  

It is currently Thu Oct 30, 2014 12:56 pm




Post new topic Reply to topic  [ 3 posts ] 
 RuneScape Name Availability Checker 
Author Message
 Post subject: RuneScape Name Availability Checker
PostPosted: Fri Jan 16, 2009 4:49 am 
User
User

Joined: Sat Jan 20, 2007 3:24 am
Posts: 103
Code:
<?php
function curl_get_contents($link) {
  $ch = curl_init();
  curl_setopt($ch,CURLOPT_URL, $link);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch,CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0');
  $html = curl_exec($ch);
  curl_close($ch);
  return $html;
}

$rsn = $_GET['rsn'];
$url = "https://create.runescape.com/input_details.ws?username="; $url .= $rsn;

$data = curl_get_contents($url);
preg_match("/var last_ajax_response \= \'(.*)\'\;/", $data, $b);

if ($b[1] == 17) { echo "$rsn|Currently Available to Register\n"; }
else { $a = str_replace("'", "", $b[1]); $a = str_replace("18,", "", $a); $a = str_replace(",", ", ", $a); echo "$rsn|Taken or Unavailable.|$a\n"; }
exit;
?>


for those of you who dont have a curl enabled host here's the same code but with file_get_contents() instead.
i hate using sockets in php so no socket example :)

Code:
<?php
$rsn = $_GET['rsn'];
$url = "https://create.runescape.com/input_details.ws?username="; $url .= $rsn;

$data = file_get_contents($url);
preg_match("/var last_ajax_response \= \'(.*)\'\;/", $data, $b);

if ($b[1] == 17) { echo "$rsn|Currently Available to Register\n"; }
else { $a = str_replace("'", "", $b[1]); $a = str_replace("18,", "", $a); $a = str_replace(",", ", ", $a); echo "$rsn|Taken or Unavailable.|$a\n"; }
exit;
?>

_________________
Vulcans Various Parsers


Offline
 Profile  
 
 Post subject: Re: RuneScape Name Availability Checker
PostPosted: Sat Jan 17, 2009 3:20 am 
User
User

Joined: Sun Jul 16, 2006 2:23 pm
Posts: 873
cURL and regex :?

_________________
-


Offline
 Profile  
 
 Post subject: Re: RuneScape Name Availability Checker
PostPosted: Sun Jan 18, 2009 11:55 am 
User
User

Joined: Mon Nov 24, 2008 1:28 pm
Posts: 334
Location: #lustra
cURL :D Regex :(


Offline
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


 Who is online 

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 
Index  |  FAQ  |  Search

phpBB skin developed by: John Olson
Protected by Anti-Spam ACP
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group