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
.
hmm good.
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.
April 21, 2008 at 2:50 pm
thats cool .