Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with curl

Status
Not open for further replies.

lonelydragon

Programmer
Aug 5, 2004
75
US
hello, i have problem with curl.
i am using curl to upload file with the folloinwgphp code. but it seems that there are some problems here. thank you for your help.
<?php

$filename = 'test.txt';

$fp = fopen($filename, "r");

$ch = curl_init();

//URL and filename with authentication details for the FTP server
curl_setopt($ch, CURLOPT_URL, 'ftp://ftp@myservername:password@ftp.myservername/new.txt');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_UPLOAD, 1);

curl_setopt($ch, CURLOPT_INFILE, $fp);

curl_setopt($ch, CURLOPT_TRANSFERTEXT, 1);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($filename));

$output = curl_exec($ch);
print_r(curl_getinfo($ch));
echo "\n\ncURL error number:" .curl_errno($ch);
echo "\n\ncURL error:" . curl_error($ch);
// ...close cURL handle ($ch) below
//echo $error;
curl_close($ch);
print $output;
?>
 
somecode is wrong when i posted here. the following is the original one:
curl_setopt($ch, curl_setopt($ch, CURLOPT_URL, ftp://ftp@myservername:password@ftp.myservername/new.txt');
 
thank you for your help.
i am just trying to do the same thing with diffent method.

the error i got is :
cURL error number:28
cURL error:Resolving host timed out:
again, thank you and have a good weekend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top