| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: secondlife.module,v 1.4.2.3 2008/12/16 16:05:54 kbahey Exp $ |
// $Id: secondlife.module,v 1.4.2.4 2009/06/11 15:52:57 kbahey Exp $ |
| 4 |
|
|
| 5 |
define('SECONDLIFE_LINDEN_SERVERS', '8.2.32.0/22,63.210.156.0/22,64.129.40.0/22,64.129.44.0/22,64.154.220.0/22,8.4.128.0/22,8.10.144.0/21,216.82.0.0/18'); |
define('SECONDLIFE_LINDEN_SERVERS', '8.2.32.0/22,63.210.156.0/22,64.129.40.0/22,64.129.44.0/22,64.154.220.0/22,8.4.128.0/22,8.10.144.0/21,216.82.0.0/18'); |
| 6 |
|
|
| 318 |
// send xml data |
// send xml data |
| 319 |
fputs($socket, $xml); |
fputs($socket, $xml); |
| 320 |
|
|
| 321 |
|
/** |
| 322 |
|
* Get the linden user profile |
| 323 |
|
*/ |
| 324 |
|
function secondlife_get_linden_user_profile($user_key) { |
| 325 |
|
$fp = fsockopen("world.secondlife.com", 80, $errno, $errstr, 30); |
| 326 |
|
if (!$fp) { |
| 327 |
|
$result = "$errstr ($errno)<br />\n"; |
| 328 |
|
} |
| 329 |
|
else { |
| 330 |
|
$out = "GET /resident/".$user_key." HTTP/1.1\r\n"; |
| 331 |
|
$out .= "Host: world.secondlife.com\r\n"; |
| 332 |
|
$out .= "Connection: Close\r\n\r\n"; |
| 333 |
|
fwrite($fp, $out); |
| 334 |
|
$result = ''; |
| 335 |
|
while (!feof($fp)) { |
| 336 |
|
$result .= fgets($fp, 128); |
| 337 |
|
} |
| 338 |
|
fclose($fp); |
| 339 |
|
} |
| 340 |
|
return $result; |
| 341 |
|
} |
| 342 |
|
/** |
| 343 |
|
* Extracts the profile picture key from the linden user profile |
| 344 |
|
*/ |
| 345 |
|
function secondlife_extract_picture_key($profile_page) { |
| 346 |
|
return secondlife_get_data_between($profile_page, '<img alt="profile image" src="http://secondlife.com/app/image/','/1" class="parcelimg" />'); |
| 347 |
|
} |
| 348 |
|
/** |
| 349 |
|
* Extracts the user name from the linden user profile |
| 350 |
|
*/ |
| 351 |
|
function secondlife_extract_username($profile_page) { |
| 352 |
|
return secondlife_get_data_between($profile_page, '<title>','</title>'); |
| 353 |
|
} |
| 354 |
// read response from rpc server |
// read response from rpc server |
| 355 |
while(!feof($socket)) $response .= fgets($socket); |
while(!feof($socket)) $response .= fgets($socket); |
| 356 |
|
|