Jump to content

Special Characters need stripping from a curl grab.


samtwilliams

Recommended Posts

Hi All,

 

I have just created a script to grab a leader board from a website, but for some reason i am getting special characters appearing between forename and surname. How would i go about stripping these out. Below is the result and code.

 

Thanks

Sam

 

 

<?php
// lets rock
$curl = curl_init();

// Set my url
curl_setopt($curl, CURLOPT_URL, 'http://scores.europeantour.com/default.sps?pagegid={7991C900-B8A2-4C34-B856-343079885E16}&redirectorid=tournament_live&eventid=2010006&infosid=2');

// Curl to get headers
//curl_setopt($curl, CURLOPT_HEADER, 1);

// Tell it not to dump but store
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//go go go
$data = curl_exec($curl);
//im done
curl_close($curl);

//kind of crap but no other way to do it  lets max the cpu for a split second.
if (preg_match("/<div id=\"scoresBoard2\">(.*)<p class=\"printText\"/s", $data, $matches)) {
    echo $matches[1];
}


?>

 

Current result set:  http://www.prentongolfclub.co.uk/ept/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.