here's a useful function that I found in the comments of a php.net function reference to quickly extract the text between two given strings, useful for parsing XML documents or HTML. I've used it to parse lotto results, XML favorites and grabbing <img> links by fopen'ing a HTML file.
$text is the string you want to parse
$s1 is the start string
$s2 is the end string
for example if this is a string in the variable $line in a file you are parsing
"<img>http://www.imageurl.com/image.gif</img>"
you can extract the url by using the function like this
Popularity: 2% [?]
No comments yet.