digitalpencil
08 Jul 2010, 02:53 PM
Hi,
I'm new here but am looking for some advice on how to extract a specific string of text from a website.
Basically, i want to echo back the friend count on a myspace profile page ( http://www.myspace.com/rachelfurner )
I would like to extract the integer '9762' (and only the integer) from the following string: Rachel Furner has <span class="redbtext" property="myspace:friendCount">9724</span> friends.
I gather i can do this by loading the page via file_get_contents and then using RegEx to extract the integer but am unsure as to the preg_match value for extracting this specific information.
Any advise on the best way to do this whether via Regular Expressions or not, would be much appreciated.
Thanks,
Dave Grant
I'm new here but am looking for some advice on how to extract a specific string of text from a website.
Basically, i want to echo back the friend count on a myspace profile page ( http://www.myspace.com/rachelfurner )
I would like to extract the integer '9762' (and only the integer) from the following string: Rachel Furner has <span class="redbtext" property="myspace:friendCount">9724</span> friends.
I gather i can do this by loading the page via file_get_contents and then using RegEx to extract the integer but am unsure as to the preg_match value for extracting this specific information.
Any advise on the best way to do this whether via Regular Expressions or not, would be much appreciated.
Thanks,
Dave Grant