Artiom Posted November 4, 2006 Share Posted November 4, 2006 I need to recieve the resulting page of http://anidb.info/perl-bin/animedb.pl?show=search&noalias=1&sa.name=Cowboy+Bebop&sa.type=4&sa.airdate0=2001&sa.atts=0&do.search=Searchas pure HTML code. Yet, when I use standard PHP file functions, they return garbage. Where do I do wrong? Help please! Is it possible to work this around with standard PHP functions (without extentions)? Quote Link to comment Share on other sites More sharing options...
joshi_v Posted November 4, 2006 Share Posted November 4, 2006 If u can post your code, it will be helpful to see where is the problem! Quote Link to comment Share on other sites More sharing options...
Artiom Posted November 4, 2006 Author Share Posted November 4, 2006 Sure :)Here it is[code]<?php$str="http://anidb.info/perl-bin/animedb.pl?show=search&noalias=1&sa.name=Cowboy+Bebop&sa.type=4&sa.airdate0=2001&sa.atts=0&do.search=Search";$f=file_get_contents($str);//$out=fgets($f);echo $f;?>[/code]I've tried using file(), fopen() with "rb" or "r" - the result slightly differs, but it is still garbage. :( Quote Link to comment Share on other sites More sharing options...
joshi_v Posted November 4, 2006 Share Posted November 4, 2006 Have you check in your php.ini settings?because when you are using an URL as file name , fopen_wrappers have been enabled.Regards,Joshi. Quote Link to comment Share on other sites More sharing options...
Artiom Posted November 4, 2006 Author Share Posted November 4, 2006 When these wrapers are disabled, PHP issues a wanrning (i've just checked on another host). In my case it actually returns some data, yet it is wrong. Quote Link to comment Share on other sites More sharing options...
Artiom Posted November 5, 2006 Author Share Posted November 5, 2006 Just in case yet another noob gets caught on this. The thing is HTML stream is gziped, gz_ group of functions has to be used. A valid code would be[code]<?php$str="http://anidb.info/perl-bin/animedb.pl?show=search&noalias=1&sa.name=Cowboy+Bebop&sa.type=4&sa.airdate0=2001&sa.atts=0&do.search=Search";$f=gzopen($str, "r");while(!gzeof($f)){$out=gzgets($f);echo $out;}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.