Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-26-2007, 05:57 AM   #1
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
:stoned PHP Guru - need ur help

I want to "Download' a file from a remote server with a PHP script.

I used this function below, but I need to enable the remote file opening option in php.ini to make it work. Let's say that I can't turn on this option for some reason. What else can I do to avoid this problem ? Is FTP functions my answer ?

Thanks

function download($file_source , $file_target) {
$rh = fopen ($file_source, 'rb');
$wh = fopen($file_target, 'wb' );
if ($rh===false || $wh=== false) {
return true;
}
while (!feof($rh )) {
if (fwrite($wh, fread( $rh, 1024)) === FALSE) {
// 'Download error: Cannot write to file ('.$file_target.')';
return true ;
}
}
fclose($rh);
fclose ($wh);
// No error
return false;
}
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-26-2007, 06:08 AM   #2
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
note : I'd like not to use the FTP functions since I don't want to maintain an anonymous FTP account only for this file ...

Is there anyway to temporarily set the remote file opening option on ?
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-26-2007, 06:23 AM   #3
AcidMax
Confirmed User
 
Join Date: May 2002
Location: MI
Posts: 1,827
You could try ini_set to try and set the option you need on in the script, but I think you are going to have to use the fsockopen functions to do the remote ftp, or if your php version has the ftp functions compiled into it, just use php's ftp ability.
__________________
Latest MMA news. http://www.mmawrapup.com
AcidMax is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.