Group name Grabber V2

One very helpful member – Cleo Collins – noticed that Linden Labs had changed the format of the search result page, breaking our Group Name Grabber service in the process. She’s donated a revised version of it, which is now live on our server.

You can see Cleo’s code after the break.

For how to use it, see the original post

// Changed by Cleo Collins to the latest LL changes. The groupname is now directly in the title tag of the page.. I inserted coments starting with Cleo where i think it needs to be changed. If the groupname service could be repaired,, it would be really great. Thanks for helping!
*  Group Name Grabber PHP script - By Hippyjim Starbrook
*  usage:
*  send a GET request with ?ky= the group key to get the name of a group with the given key
*  if the request is malformed, or the key doesn't exist, returns X
$groupKey = $_GET["ky"];
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "".$groupKey);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// grab URL and pass it to the browser
$dump = curl_exec($ch); 
// close cURL resource, and free up system resources
// remove all HTML tags from the result, except the <h1> tags (which will surround our group name)
// Cleo: Not needed anymore, the group name can now be found directly in the <title> tags
//$dump = strip_tags($dump, "<h1>");
// if the reply doesn't include the phrase "The specified key does not exist" take the page apart
// Cleo: now seems to be "AccessDenied" instead
if (!strpos($dump, "AccessDenied"))
    // find the position of the phrase "Group:" in the page, as that shows the start of our group name
    // Cleo: we now just look for <title>
    $groupPos = strpos($dump, "<title>")+ 7;
    // find the closing </h1> tag immediately after "Group:" as that signifies the end of our group name
    // Cleo: well, again we just search for </title>
    $endPos = strpos($dump, "</title>", $groupPos);
    // our group name is the string in between these two points
    $groupName = trim(substr($dump, $groupPos, $endPos-$groupPos));
    // output the group name
    echo $groupName;
// otherwise output an X
    echo "X";

1 comment so far ↓

#1 Overbrain Unplugged on 11.07.10 at 10:58 pm

What about a group key grabber? That would be helpful.

You must log in to post a comment.