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>
The easiest way would be to use DOM and XPath:
The above uses the DOM extension to load the XML file with the webcam states. It then searches for the
<webcam>element with anicknameattribute containing the passed$performername. Assuming there will be only one cam per performer nickname, this method will returnFALSEif no element matched the XPath orTRUEif 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: