0

I am going to write a parser that is going to get information from a website.

However something is wrong with this website and soon as i fetch the information and put it in a file, it's all gibberish.

The website is anidb.net

Could anyone tell me why i get gibberish instead of the HTML?

My code

<?php
$url = 'http://anidb.net/perl-bin/animedb.pl?show=anime&aid=854';

file_put_contents("file.txt", file_get_contents($url));
?> 

May i also add that using the browser's View Source function i see the HTML.

dikidera
  • 2,004
  • 6
  • 29
  • 36
  • 3
    Please specify the result; gibbrish is very unspecific – Zirak Apr 10 '11 at 09:45
  • You would have to show the gibberish to tell for sure, but chances are that the content you're receiving is gzip encoded. – Pekka Apr 10 '11 at 09:45
  • Юэ+=ґw“±•¤№kЖ'»MчљЏ™фљir}ЪбJґНXўt"е]зЇ?Ђ)‹ЦжЪ—µшЃ That's it(if you can see the characters) – dikidera Apr 10 '11 at 09:50

1 Answers1

5

I checked the headers on the page that you specified and it's returning:

Content-Encoding: gzip

That means the 'gibberish' you're seeing is indeed gzip encoded. Here's another thread that should help you out: Decode gzipped web page retrieved via cURL in PHP

Community
  • 1
  • 1
soulkphp
  • 3,753
  • 2
  • 17
  • 14