PHP XML Parsing Problem for Alexa Rank

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmcog
    Confirmed User
    • Sep 2004
    • 825

    #1

    PHP XML Parsing Problem for Alexa Rank

    I'm trying to create a small PHP script that reads an XML file and extracts the value of an attribute (if that makes sense)

    Example:

    XML file: http://data.alexa.com/data?cli=10&da...ckyourself.com

    The part I'm looking for is this one: <REACH RANK="4582"/>

    The script is supposed to output "4582" but nothing is working and its 6:17am

    Please
  • nmcog
    Confirmed User
    • Sep 2004
    • 825

    #2
    bump.....

    Comment

    • grumpy
      Too lazy to set a custom title
      • Jan 2002
      • 9870

      #3
      stil looking?
      Don't let greediness blur your vision | You gotta let some shit slide
      icq - 441-456-888

      Comment

      • mortenb
        Confirmed User
        • Jul 2004
        • 2203

        #4
        Originally posted by nmcog
        I'm trying to create a small PHP script that reads an XML file and extracts the value of an attribute (if that makes sense)

        Example:

        XML file: http://data.alexa.com/data?cli=10&da...ckyourself.com

        The part I'm looking for is this one: <REACH RANK="4582"/>

        The script is supposed to output "4582" but nothing is working and its 6:17am

        Please

        If you only want that one part there is not need to really parse the XML..

        PHP Code:
        $data    = file_get_contents("http://data.alexa.com/data?cli=10&dat=snbamz&url=www.gofuckyourself.com");
        
        ereg("REACH RANK=\"([0-9]+)",$data,$regs);
        
        echo $regs[1]; 
        
        replace hahaha91; with [

        that should do it..

        Comment

        • nmcog
          Confirmed User
          • Sep 2004
          • 825

          #5
          Thanks, it works great

          Comment

          • mortenb
            Confirmed User
            • Jul 2004
            • 2203

            #6
            no problem

            Comment

            Working...