| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: secondlife.module,v 1.4.2.6 2009/06/11 15:58:32 kbahey Exp $ |
// $Id: secondlife.module,v 1.4.2.7 2009/06/11 18:17:39 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 |
|
|
| 299 |
fputs($socket, "Content-type: text/xml\r\n"); |
fputs($socket, "Content-type: text/xml\r\n"); |
| 300 |
fputs($socket, "Content-length: ".strlen($xml)."\r\n"); |
fputs($socket, "Content-length: ".strlen($xml)."\r\n"); |
| 301 |
fputs($socket, "Connection: close\r\n\r\n"); |
fputs($socket, "Connection: close\r\n\r\n"); |
| 302 |
|
|
| 303 |
// send xml data |
// send xml data |
| 304 |
fputs($socket, $xml); |
fputs($socket, $xml); |
| 305 |
|
|
| 306 |
|
// read response from rpc server |
| 307 |
|
while(!feof($socket)) $response .= fgets($socket); |
| 308 |
|
|
| 309 |
|
// close the connection |
| 310 |
|
fclose($socket); |
| 311 |
|
|
| 312 |
|
// parse out the returned data |
| 313 |
|
$sVal = secondlife_get_data_between($response, 'StringValue</name><value><string>','</string>'); |
| 314 |
|
$iVal = secondlife_get_data_between($response, '<value><int>','</int></value>'); |
| 315 |
|
|
| 316 |
|
// return the response data in an array |
| 317 |
|
return array('channel' => $channel, 'string' => $sVal, 'integer' => $iVal); |
| 318 |
|
} |
| 319 |
/** |
/** |
| 320 |
* Get the linden user profile |
* Get the linden user profile |
| 321 |
*/ |
*/ |
| 349 |
function secondlife_extract_username($profile_page) { |
function secondlife_extract_username($profile_page) { |
| 350 |
return secondlife_get_data_between($profile_page, '<title>','</title>'); |
return secondlife_get_data_between($profile_page, '<title>','</title>'); |
| 351 |
} |
} |
|
// read response from rpc server |
|
|
while(!feof($socket)) $response .= fgets($socket); |
|
|
|
|
|
// close the connection |
|
|
fclose($socket); |
|
|
|
|
|
// parse out the returned data |
|
|
$sVal = secondlife_get_data_between($response, 'StringValue</name><value><string>','</string>'); |
|
|
$iVal = secondlife_get_data_between($response, '<value><int>','</int></value>'); |
|
|
|
|
|
// return the response data in an array |
|
|
return array('channel' => $channel, 'string' => $sVal, 'integer' => $iVal); |
|
|
} |
|