Reply to Re: download files from a website

Your name:

Reply:


Posted by weetat on 02/05/07 07:07

Hi Vivek ,

Downloading file from web page using PHP , see below.
For write data to file , look up the file function in php manual, it
have some examples.

Thanks

$filename = 'Your file name';
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// browser must download file from server instead of cache
// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
// use the Content-Disposition header to supply a recommended filename
and
// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=" .
basename($filename) . ";");

/*
The Content-transfer-encoding header should be binary, since the file
will be read
directly from the disk and the raw bytes passed to the downloading
computer.
The Content-length header is useful to set for downloads. The browser
will be able to
show a progress meter as a file downloads. The content-lenght can be
determines by
filesize function returns the size of a file.
*/

header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));

readfile("$filename");
exit();




On Feb 5, 11:20 am, "vivekmaha...@gmail.com" <vivekmaha...@gmail.com>
wrote:
> Hey guys,
>
> Is it possible to download files from a website using PHP ?? If yes,
> then how ??
> Also, how do I write data to a file in php ??
>
> If these functions can be done in PHP then please let me know how I
> can do it. Also, where can I see all the functions of PHP ?? Is there
> something like an API that I can look at ?
>
> Please reply soon.
>
> Thank you,
>
> Vivek

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация