I’m trying to use cURL to grab an external web page to put into my own website, it’s basically a “ladder” of a sports team, I contacted them, but they do not have a RSS feed of the ladder, so I’m trying to obtain the ladder by other means, is it possible to grab everything between < table > and < / table > using cURL? I can grab the page that I want using the following code, but I don’t need anything else except for the HTML table.
$ch = curl_init ("http://www.sportingpulse.com/rpt_ladder.cgi?results=N&round=15&client=1-3909-47801-81021-6151461&pool=-1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $page = curl_exec($ch);
If someone could help me out, that’d be great. Thanks
Leanne
You’ll need to use curl to grab the contents of the page and string processing to extract the table from the returned string.
A simple regex to start would be:
So if you take your example above, you’d do something like:
This code will match the first table on the page. You’d need to tweak it to match exactly the HTML you want to extract.