cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: remote file upload to remote ftp server

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 13 Nov 2005 11:35:05 +0100 (CET)

On Sun, 13 Nov 2005, dynamite media wrote:

> what i would like to use the getpageinvar and the ftp together, so it
> would look something like this....
>
> <?php
> $ch = curl_init();
>
> curl_setopt($ch, CURLOPT_URL,'$URL');   ( i may need the u-flag here 
> -u'$name':'$pass''$url')
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
> $result=curl_exec ($ch);
>
> if  ... something to do with the $result
>
> curl_setopt($ch, CURLOPT_URL,
>             "ftp://'$fname':'$fpass'@ftp.'$fsite'/'$fpath'/'$result'");
> curl_setopt($ch, CURLOPT_UPLOAD, 1);
> curl_setopt($ch, CURLOPT_INFILE, '$name');
> curl_close ($ch);
> ?>

Ok, you want to first download the file and then upload it. Then I suggest you
save it to a temporary file in the download step, just to make things easier
for you (you don't _have to_, but not doing it requires some more advanced
PHP-magic).

> and what i would like to do then is have a form or inpus on the site to
> input the following:

> $name
> $pass
> $url
> $fname
> $fpass
> $fsite
> $fpath

Right, but I don't see how this is relevant to PHP/CURL at all. Surely you
need to write a prorper program yes, but that is what programming is about.

> i really would like the progress bar as well but have no clue how that works
> either...

I don't think you can (easily) get a progress bar when doing this.

> the files i want to upload are not all on the sercer running the php/curl 
> and some need authenization.

Then use "authenization". CURLOPT_USERPWD is mostly likely what you need for
the ftp upload part if you don't want the name+password in the URL itself.

> i would need someone to right the php cause i dont know how to do it
> correctly

Sure, we (Haxx) offer custom scripts for anyone who pays. Don't expect us (or
even anyone else actually) to write complex custom scripts that do YOUR work
for free.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-11-13