RuneScape Name Availability Checker

Everything PHP-related! Discuss scripts, host challenges, request a script, or just ask for plain old help.

Moderators: IRC Operators, Support Team

iVulcan
User
User
Posts: 103
Joined: Sat Jan 20, 2007 3:24 am

RuneScape Name Availability Checker

Postby iVulcan » Fri Jan 16, 2009 4:49 am

Code: Select all

<?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: Select all

<?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;
?>
slushpuppy
User
User
Posts: 873
Joined: Sun Jul 16, 2006 2:23 pm

Re: RuneScape Name Availability Checker

Postby slushpuppy » Sat Jan 17, 2009 3:20 am

cURL and regex :?
-
LustraTheGoodMan
User
User
Posts: 334
Joined: Mon Nov 24, 2008 1:28 pm
Location: #lustra

Re: RuneScape Name Availability Checker

Postby LustraTheGoodMan » Sun Jan 18, 2009 11:55 am

cURL :D Regex :(

Return to “PHP”

Who is online

Users browsing this forum: No registered users and 1 guest