Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    PHP script - no longer working

    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

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    When I run your script all by itself I get this:

    LNK17C FSX 0' 0

  • #5
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    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?

  • #7
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •