954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

can we download files from other websites using php

Hi,

in our school, downloading of music files,aqvis,mpeg, exes, zips are disallowed ,

since i know a bit of php , i wanted to know if i can initiate a download from some http address, using php, and after the file has downloaded into the web server, php renames the .zip to a image format like .jpg, and then i can download it directly from this webserver, since it bypasses the block in our school firewall.

(our firewall is not that sophisticated, just a cgi script that checks the file extension, and filters offensive words).

Is it possible? I know its possible to ftp connect , but what about plain http?

Thanks,

Ishwar :mrgreen:

ishwar
Newbie Poster
24 posts since Jul 2006
Reputation Points: 8
Solved Threads: 0
 

even if you could it when php finds the files and downloads it windows will recognize it as w/e and not let you do it. You could just do like a save as like .txt open it with notepad and then save it as w/e extension it was before.

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

Schools, businesses and publicly accessible pc's have a firewall with restricted traffic streams on them for a reason - to stop abuse, reduce bandwidth and prevent virus infection. If you have a legitimate need to download files that have been blocked by the network admin, then the best thing to do is speak to the network admin.

Lafinboy
Junior Poster
172 posts since Jul 2004
Reputation Points: 16
Solved Threads: 7
 
Schools, businesses and publicly accessible pc's have a firewall with restricted traffic streams on them for a reason - to stop abuse, reduce bandwidth and prevent virus infection. If you have a legitimate need to download files that have been blocked by the network admin, then the best thing to do is speak to the network admin.




yes i know that , i'm just asking if its possible with php , knowledge is free.:confused:


Ishwar

ishwar
Newbie Poster
24 posts since Jul 2006
Reputation Points: 8
Solved Threads: 0
 
even if you could it when php finds the files and downloads it windows will recognize it as w/e and not let you do it. You could just do like a save as like .txt open it with notepad and then save it as w/e extension it was before.




what do you mean windows will recogonize it?

the firewall is a linux with a stupid cgi script.


Ishwar

ishwar
Newbie Poster
24 posts since Jul 2006
Reputation Points: 8
Solved Threads: 0
 

well I figured your school comp has windows on it and if your running a local script to fetch a file with a certain file extension it will still stop that file from being transfered to the script. Im no expert on this just try it out goto php.net and search some commands.

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 
well I figured your school comp has windows on it and if your running a local script to fetch a file with a certain file extension it will still stop that file from being transfered to the script. Im no expert on this just try it out goto php.net and search some commands.



Hi , I think misunderstood my plans : here is a bit more detailed version:get a web host with php,
create a php script that downloads files from other websites , eg. - it downloads http://www.samplesite.com/samplefile.exe , and it stores the file on the server
it renames samplefile.exe to samplefile.jpg
we can then download this file from the school, on demand from this webserver, since it passes the firewall extension check,
and voila, enjoy your file

ishwar
Newbie Poster
24 posts since Jul 2006
Reputation Points: 8
Solved Threads: 0
 

oh yea I thought you meant locally run the script but yea that should work

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

Well , now the big problem comes,

How do I do it.

Ishwar

ishwar
Newbie Poster
24 posts since Jul 2006
Reputation Points: 8
Solved Threads: 0
 

I believe you are under estimating the power of the stupid cgi script. Otherwise you would just need a stupid php script for your purpose which is just as stupid. :)

Take a look at the stream function section of the PHP manual on php.net
It has all you need, including changing the mime-type which is most likely what the stupid cgi script checks as an extension is meaningless to the http protocol.

digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 
yes i know that , i'm just asking if its possible with php , knowledge is free.:confused: Ishwar

yes this is very possible with PHP, ASP, JSP

the only thing here is that not all web hosting companies will let you "access" files from another host (this is in case someone manages to hack your website and tries to get it to do malicious things to other computers)

paradox814
Posting Whiz
351 posts since Oct 2004
Reputation Points: 13
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You