Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3215668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:12:16+00:00 2026-05-17T15:12:16+00:00

As allways I’m abit over my head but this time I’m really pushing myself.

  • 0

As allways I’m abit over my head but this time I’m really pushing myself. hehe.
I dont have any code yet for my new little project because I’m not really sure where to start.

Here is the background info of what I need to do.
What I’m trying to do is a “status indicator” for one of my (adult) wecam advertising sites.
The performers who is online are listed in a XML (online.xml). Thats fair enough to pull out but here is where it stops for me.
What I need to make is a simple php script (ex. status.php?id=performername) that will check if the performers name is in the xml list or not and give me a online/offline reply. All good ideas and help are very welcomed. 🙂

XML Example (cleaned version)

<webcams_online>
<webcam account="a6632" sex="F" star="N" nickname="18brunette" priority="11289" preview_webcam="6632_webcam.jpg" number_visitors="none">
</webcam>

<webcam account="a18205" sex="F" star="N" nickname="Attraction" priority="11155" preview_webcam="18205_webcam.jpg" number_visitors="none">
</webcam>
</webcams_online>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:12:17+00:00Added an answer on May 17, 2026 at 3:12 pm

    The easiest way would be to use DOM and XPath:

    public function isOnline($performer)
    {
        $dom = new DOMDocument;
        $dom->load('webcams.xml');
        $xPath = new DOMXPath($dom);
        $nodes =  $xPath->query(sprintf('//webcam[@nickname="%s"]', $performer));
    
        return (bool) $webcams->length;
    }
    

    The above uses the DOM extension to load the XML file with the webcam states. It then searches for the <webcam> element with a nickname attribute containing the passed $performer name. Assuming there will be only one cam per performer nickname, this method will return FALSE if no element matched the XPath or TRUE if it was matched.

    You didnt specify how you wanted the script to respond. Assuming you are checking the cams via Ajax, a simple status.php script could look like this:

    <?php
    
    // Clean input to script
    $performer = filter_input(
        INPUT_GET, 'performer', FILTER_SANITIZE_STRING,
        FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW);
    
    // Try to find webcam with nickname of performer in online cams XML
    $dom = new DOMDocument;
    $dom->load('webcams.xml');
    $xPath   = new DOMXPath($dom);
    $webcams = $xPath->query(sprintf('//webcam[@nickname="%s"]', $performer));
    
    // send a JSON response depending on the search result
    header('Cache-Control: no-cache, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    header('Content-type: application/json');
    
    // create a JSON response for the calling client
    if( $webcams->length === 0 ) {
        echo json_encode(array('status' => 'offline'));
    } else {
        $webcam = $webcams->item(0);
        echo json_encode(array(
            'status'   => 'online',
            'data' => array(
                'account'  => $webcam->getAttribute('account'),
                'sex'      => $webcam->getAttribute('sex'),
                'star'     => $webcam->getAttribute('star'),
                'nickname' => $webcam->getAttribute('nickname'),
                'priority' => $webcam->getAttribute('priority'),
                'preview'  => $webcam->getAttribute('preview_webcam'),
                'visitors' => $webcam->getAttribute('number_visitors')
            )
        ));
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been hashed over a number of time, but I have
I have the following problem. The alert allways returns undefined, but I know it
I tried this but it doesn't seem to work,,, any Idea why not ?
When i run this code i get errors sometimes but not allways. I cant
I have a string which is allways in this format: 7 May 2012 or
i am trying like this: if($('input:checkbox:checked').length > 0 == false){ but this will allways
Im trying to submit a specific form programatically, but I allways get the initial
I have two tables. Both tables are editable and both tables should allways be
I have this code in the view to display datepicker for input type.. Problem
Like allways, in Firefox, Chrome, Safari and Opera everything works without a problem. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.