Jump to content

weird special characters when loading xml


if

Recommended Posts

i tried this

$string = file_get_contents('http://torrents.thepiratebay.org/filelist/4137201');
echo  $string;

 

and this is the result

‹������µÔMkƒ0ð{?EðÞú0ñ‘"£O–o:JΨ…lxö–²“gO×\I¢±I3gI3gI3WI3ó‡!•£7ÍÍÍÍŸwHÁ‚F7g˜s¦TJÙ³•l ƒ"~GÏmò ²¿Sû ��

 

any ideas ?

It's returning the gzipped version. With cURL you can specify to not return the gzipped version:

<?php
  $url = 'http://torrents.thepiratebay.org/filelist/4137201';
  $ch = curl_init();
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_ENCODING,'deflate');
  $xml = curl_exec($ch);
  echo $xml;
?>

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.