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 2 of 2
  1. #1
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post

    Parser is invalid

    Hi there, does this seem right?

    PHP Code:
    <?php 

    $file 
    file_get_contents("http://minecraft.net");

    preg_match("/<div id=\"links\">(.*?)<br\/>/"$file$post);

           
           echo 
    "MC Stats: $post[0] <br />";
    ?>
    Doesn't work... I get the error:

    Code:
    Notice: Undefined offset: 0 in C:\wamp\www\crafthub\stats\stats.php on line 8
    MC Stats:
    Ok now go to: http://minecraft.net. Then view source and go to <div id="links"> etc... Well, how do I grab that? I am doing it wrong (hence the error). Can anyone help me?

    Thanks.
    Last edited by UrbanTwitch; 09-06-2009 at 07:46 PM.
    Formerly MysticScript

    6+ years club

  • #2
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    Regex sucks don't it:

    PHP Code:
    <?php
    $file 
    file_get_contents("http://minecraft.net");

    preg_match("/<div id=\"links\">(.+?)<\/div>/si"$file$post);

    echo 
    "MC Stats: $post[0] <br />";
    ?>
    Should work out for ya.
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]


  •  

    Posting Permissions

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