Grab external div text?

Hey,

I’m trying to build a profile base for a group of drivers, it needs to show how much money they have raised for a charity event which is kept on an external page. However, i can’t seem to find a way to successfully grab the needed content.

Here is the code i am trying at the moment, everytime i run it it only shows the “fail” line though.
[php]
$charity_link = “http://uk.virginmoneygiving.com/team/RallyforHeroes2012”;
$string = file_get_contents($charity_link);
if (preg_match(’/

([^<]*)</div>/’, $string, $matches) > 0) {
echo $matches[1]; //This is text one
} else {
echo “fail”;
}
[/php]

It’s trying to grab the total figure on the right hand side, but it doesn’t show me anything? Please help! I have also tried removing the style=“padding-right: 10px;” from the end of the div but it still doesn’t work!

Much thanks,
Steve

Hi you want to get data from one html page to another if so then you have two easy ways.

  1. get it using $_GET which will show the data in url and you can get in other page using $_REQUEST

  2. get it using $_POST which will show the data in url and you can get in other page using $_REQUEST

Hope this will help you

Sponsor our Newsletter | Privacy Policy | Terms of Service