Hello,
My problem is concerning special characters, such as "—" which come in as "—" in the resulting string of my fgets(). Does anyone know a way around that?
On the page I an trying to scrape information off, the sentance looks like this:
HARRISBURG (AP) — The debate on gambling in Pennsylvania shifted Thursday...
I am using the following code:
$data = fopen($URL,"r");
if ($data) {
while (!feof($data)) {
$buffer .= fgets($data,4096);
}
fclose($dataFile);
} else {
die("fopen failed for $URL");
}
But when I echo my resulting $buffer string, the output looks like this:
HARRISBURG (AP) — The debate on gambling in Pennsylvania shifted Thursday...
It happens with all the non-ASCII characters. Please help if you know the solution!