Gayngel

World API valid UUID Check

May 18th, 2021 (edited)
1,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. key uuid = "a9ba2797-81af-429d-9833-51127ad5593c"; // the uuid you want to check is a valid avatar, group or place
  2. string api = " http://world.secondlife.com/resident/";
  3.  
  4. // To check uuid is a valid group use:
  5. // string api = " http://world.secondlife.com/group/";
  6.  
  7. // To check uuid is a valid destination in SL use:
  8. // string api = " http://world.secondlife.com/place/";
  9.  
  10.  
  11. key reqID;
  12.  
  13. default
  14. {
  15.     state_entry()
  16.     {
  17.        reqID = llHTTPRequest(api+(string)uuid,[HTTP_METHOD,"POST"],"check");
  18.     }
  19.  
  20.  
  21.    
  22.    http_response(key request, integer status, list metadata, string body)
  23.    {
  24.        
  25.        if(request == reqID)
  26.        {
  27.            
  28.           integer title = llSubStringIndex(body,"<title>");     // only a valid uuid contains a <title> meta tag
  29.                                                                 // an invalid uuid contains an h3 metatag ie: <h3>Page Not Found</h3>
  30.          
  31.           if(title != -1)
  32.           {
  33.              
  34.  
  35.             llOwnerSay("UUID is an avatar!"); //or
  36.             // llOwnerSay("UUID is a group!"); //or
  37.             //llOwnerSay("UUID is a place!");
  38.              
  39.           }
  40.          
  41.           else
  42.             {
  43.           llOwnerSay("UUID is invalid! UUID is not an avatar."); //or
  44.           //llOwnerSay("UUID is invalid! UUID is not a group."); //or
  45.           //llOwnerSay("UUID is invalid! UUID is not a place."); //or
  46.               }
  47.            
  48.         }
  49.     }
  50. }
Add Comment
Please, Sign In to add comment