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

curl-and-php

Re: PHP, libcURL, and FTP login problems

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Wed, 11 Aug 2010 22:38:50 -0400

I'm guessing you have your target URL set up now as
user:pass_at_ftp.server.ca<user%3Apass_at_ftp.server.ca>. As far as:
Is there a better way to add in the username and password
I think you can use CURLOPT_USERPWD, with value "test:test", although since
it works essentially the same way I don't think it will help.
FWIW, I tried the code you mentioned on my server and (having corrected one
typo) it worked. Although it's not really a cURL solution, you might have
better luck with the native PHP FTP library, which is well-documented over
at php.net.
-Stephen

On Wed, Aug 11, 2010 at 17:16, Stewart C. Baker <sbaker_at_csudh.edu> wrote:

> Greetings, list
>
>
>
> I am a bit of a neophyte when it comes to heavy-duty web programming (which
> this is not), so please bear with me.
>
>
>
> I have a bit of code that is supposed to take a user’s uploaded file and,
> using libcURL, send it to a remote server which has an FTP set up. The FTP
> uses a username and password, and is not set to receive anonymous
> connections. The code that I am using is pretty much an exact copy of the
> example code on the cURL site (
> http://curl.haxx.se/libcurl/php/examples/ftpupload.html) except that it is
> die($error)-ing on errors at the moment while I test.
>
>
>
> I set the FTP URL to make sure I have that right, and I get the error I was
> expecting: login denied (67). So far, so good. The problem comes in when I
> uncomment the username and password; then, instead of a “could not log in”
> error, I am for some reason getting a “could not resolve host” error (6). I
> have tried hard-cording the username/password instead of using the
> variables, removing the { } from the $remoteurl, and commenting out and
> removing the remotepath, none of which did anything.
>
>
>
> Is there a better way to add in the username and password, and/or can
> anybody figure out why it’s doing this? Cheers. J
>
>
>
> (I am on Windows Server 2003, IIS6, and PHP 5.2.6, if that is germane.)
>
>
>
> Stewart Baker
>
> Cal State Dominguez Hills
>
> University Library
>
> Web Services / Reference Librarian
>
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-08-12