...

View Full Version : PHP script - no longer working



G-NEWC
10-26-2009, 11:52 AM
Hi All

I asked for help a few months back now to do with this code, I finally got it sorted, and it was working fine. It only worked for the first couple of weeks, then stopped working.

The code is below - i would be grateful if anyone could show me any errors or point me in the right direction. The code is to connect to an FS multiplayer server and report back online players onto the website. Currently, when trying to access the page that the code is on, just continues to load. It takes about 4-5 mins to load, and then only includes the headers of the table.


<?php

// XML Page
$feed_url = "http://64.22.78.67:98/xml";

# INITIATE CURL.
$curl = curl_init();

# CURL SETTINGS.
curl_setopt($curl, CURLOPT_URL,"$feed_url");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);

# GRAB THE XML FILE.
$xmlX = curl_exec($curl);

curl_close($curl);

# SET UP XML OBJECT.
# Use either one of these, depending on revision of PHP.
# Comment-out the line you are not using.
//$xml = new SimpleXMLElement($xmlX);
$xml = simplexml_load_string($xmlX);

foreach($xml->Players->Player as $player)

{

echo "<table cellpadding=\"0\" border=\"0\" width=\"500px\">

<td width=\"20%\">$player->Name </td>
<td width=\"20%\">$player->GameVersion </td>
<td width=\"20%\">$player->Altitude</td>
<td width=\"20%\">$player->Speed </td>
<td width=\"20%\">$player->NearAirport </td>

</tr>
";}?></center>



Many thanks in Advance,



James

mlseim
10-26-2009, 01:33 PM
It seems to be working for me.
I wonder if they were having some server problems?
Or what happens if nobody is currently playing the game?

G-NEWC
10-26-2009, 01:36 PM
I'm currently on the gameserver at the moment - it still doesn't work for me. I am right in saying i can just save the below as a php file, and open it on the browser?

And i've tried it on a couple of free hosts aswell as my host at the moment, still no luck i'm afraid. Are there any settings I should have enabled or set, to make it work?


Thanks,

James

mlseim
10-26-2009, 02:36 PM
When I run your script all by itself I get this:

LNK17C FSX 0' 0

G-NEWC
10-26-2009, 02:39 PM
Yes, that is correct. I am the only player on the server at the moment as it is daytime over here, it usually get's busier in the evenings.

The LNK17C translates to the username, FSX to GameVersion 0' Altitude, and 0 Speed. NearAirport is not needed when offline.

Thanks,


James

mlseim
10-26-2009, 02:55 PM
So if it doesn't work for you, it has to be some sort of server thing ...
your webhost (where your script is located). Perhaps your webhost
made some changes to PHP or some server settings?

G-NEWC
10-26-2009, 02:58 PM
I'll send him a mail to ask. I've tried to upload to a couple of free host's as i've mentioned, though, and i've no luck there either.

Thanks again for your help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum