View Single Post
Old 03-28-2005, 05:51 AM  
mortenb
Confirmed User
 
mortenb's Avatar
 
Join Date: Jul 2004
Location: Denmark ICQ: 7880009
Posts: 2,203
Quote:
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..
mortenb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote