Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
ftp connection with an @ sign in the username does not work
Old 03-25-2009, 11:52 AM ftp connection with an @ sign in the username does not work
Skilled Talker

Posts: 83
Trades: 0
Hello,

I want to upload a file from my website to another website using curl. This used to work fine, but now this other website has changed host and his username is now an email address. The method does not work anymore.

Code:
curl_setopt($ch, CURLOPT_URL, 'ftp://info@xxxxxxxxxx.xx:xxxxxxx@ftp.hosting.com/htdocs/shop/gabor_man.csv');
Now there are 2 @ signs in the above. I think this confuses the system. Or should this work? WHat should i do?

thanks!

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-25-2009, 02:31 PM Re: ftp connection with an @ sign in the username does not work
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Try creating a different username (The @ does confuse it, in your case just try "info") for the FTP or using PHP FTP functions:
http://uk2.php.net/manual/en/book.ftp.php
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-27-2009, 12:13 PM Re: ftp connection with an @ sign in the username does not work
Skilled Talker

Posts: 83
Trades: 0
hello,

It does not seem to go to create a ftp username without an @.

So i looked at the ftp php function:

PHP Code:
$ftp_server 'ftp3.newhosting.hu';
$ftp_user_name 'xxxxxx';
$ftp_user_pass 'xxxxxx';
// set up basic connection
$conn_id ftp_connect($ftp_server); 

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
        echo 
"FTP connection has failed!";
        echo 
"Attempted to connect to $ftp_server for user $ftp_user_name"
        exit; 
    } else {
        echo 
"Connected to $ftp_server, for user $ftp_user_name";
    }
    
$destination_file 'htdocs/gabor_man.csv';
$source_file 'gabor_man.csv';
// upload the file
$upload ftp_put($conn_id$destination_file$source_fileFTP_BINARY); 

// check upload status
if (!$upload) { 
        echo 
"FTP upload has failed!";
    } else {
        echo 
"Uploaded $source_file to $ftp_server as $destination_file";
    }

// close the FTP stream 
ftp_close($conn_id); 
This is the output:
Code:
Connected to ftp3.newhosting.hu, for user xxxxxx
Warning:  ftp_put() [function.ftp-put]: Unable to build data connection: No route to host in /home/m6513mic/public_html/gabor.php on line 190
FTP upload has failed!
What could be wrong?

thanks!

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 03-28-2009, 07:31 AM Re: ftp connection with an @ sign in the username does not work
Skilled Talker

Posts: 83
Trades: 0
Anyone who can shed some light on this?

thanks
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 03-28-2009, 08:14 AM Re: ftp connection with an @ sign in the username does not work
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Well, the problem is not in the logic of your script.

An "No routes to host" error is a TCP layer error that means that your php server did find an ip address for the target machine, but could not reach this target ip.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-29-2009, 06:52 AM Re: ftp connection with an @ sign in the username does not work
Skilled Talker

Posts: 83
Trades: 0
so theres not much i can do about that?
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 03-29-2009, 10:06 AM Re: ftp connection with an @ sign in the username does not work
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I'm afraid not, no.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-29-2009, 10:07 AM Re: ftp connection with an @ sign in the username does not work
Skilled Talker

Posts: 83
Trades: 0
ok thanks
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ftp connection with an @ sign in the username does not work
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26741 seconds with 12 queries