Boolean Island !

Awesome File Trick

Posted by: ranacse05 on: April 21, 2008

I was just reading PHP and got a awesome function named file_get_contents() it returns the whole file as a string.But the special thing is it can read web sites too :) .For example here is a code
$data = @file_get_contents(‘http://www.google.com’);
echo $data;
$file = fopen(‘google.txt’,'w’);
fwrite($file,$data);

First line will get the contents of www.google.com
Then it’ll show the data
And then it’ll save into a file named google.txt.

U can use it when u need some data from another site and if that site dont use the rss .

Note : Special thanks to Hasin Bhai he told me about this function a few days ago but i just forgot :( .

5 Responses to "Awesome File Trick"

similarly , use file_put_contents() to write data inside a file :D

@Hasin Bhia
Thanks again for this new function. :D

i am getting one line from another site. but some characters are bad-looking now. i searched fixing the problem but not found.

someone said to change your code :

echo mb_convert_encoding($data[394], ‘utf-8′);

but i doesn’t work. why i solve the problem? thanks for your help.

Leave a Reply

My blog worth


My site is worth $3431.
How much is yours worth?

My Twittes

FireFox

Firefox 3

My Facebook

this is Raquibul's profile

View Raquibul Islam's profile on LinkedIn

My fav

 

April 2008
S M T W T F S
« Mar   May »
 12345
6789101112
13141516171819
20212223242526
27282930  

Flickr Photos

Moon !

Moon !

Leevio

Leevio

Leevio

Tea !

History

me

More Photos

My Bookmarks

Dynamic Malloc

Blog Stats

  • 46,557 hits