PlanetSide Universe - View Single Post - Online/Offline status request
View Single Post
Old 2013-06-09, 12:18 AM   [Ignore Me] #6
Saladin
Private
 
Talking Re: Online/Offline status request


get/ps2-beta/character/?name.first=MrFaodBriggs&c:show=name,online_status &c:resolve=online_status

http://pside.co/19TTI9Y <-- sandbox link to what information that is passed from this above..

you would have to do multiply calls in order to do it but this just one person that you have listed...

I could do it in PHP but would take a little to get them all listed in it..

Ok below I know works and little ruff around edges but gets the job done... I used a txt file to make a listing called gms.txt with the game names of the people you want to know if there online.. it is not pretty by any kind of terms. If there offline will display 0 and a number when there online... now test it send me a pm if you wish to do more with it

PHP Code:
<?php
//Will need a txt file called gms.txt with new line for every game name wish to look up
//Enter service ID below 
$service_id " ";

//Below this point do NOT edit unless know what you are doing
// Setting up the API request going to be made
$site "http://census.soe.com/";
$format ="get";
$verb="ps2-beta";
$collection="character";
$call="?name.first=";
$modifier="&c:show=name,online_status&c:resolve=online_status";
//Checks to see if there is a service ID listed above
if($service_id "" $service_id " "$sid False; else $sid True;

//open file
$file "gms.txt";
$gm = array();
$fp = @fopen ($file"r");
if (
$fp) {
    
//for each line in file
    
while(!feof($fp)) {
    
//push lines into array
    
$this_line fgets($fp);                  
    
array_push($gm,$this_line);
    }
//close file
fclose($fp);
}


for(
$i=0;$i<count($gm);$i++){
    if(
$sid){
    
$json file_get_contents($site."s:".$service_id."/".$format."/".$verb."/".$collection."/".$call.rtrim($gm***91;$i***93;).$modifier);
    
$obj  = (json_decode($jsontrue));
    if(!empty(
$gm***91;$i***93;))    echo $gm***91;$i***93;.":".$obj***91;'character_list'***93;***91;'0'***93;***91;'online_status'***93;."</br>";
    
//echo $site."s:".$service_id."/".$format."/".$verb."/".$collection."/".$call.$gm***91;$i***93;.$modifier;
    
} Else {
    
$json file_get_contents($site.$format."/".$verb."/".$collection."/".$call.rtrim($gm***91;$i***93;).$modifier);
    
$obj  = (json_decode($jsontrue));
    if(!empty(
$gm***91;$i***93;))    echo $gm***91;$i***93;.":".$obj***91;'character_list'***93;***91;'0'***93;***91;'online_status'***93;."</br>";
    }
    
}
?>

Last edited by Saladin; 2013-06-09 at 01:44 AM. Reason: added sandbox link
Saladin is offline