lonelydragon
Programmer
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
assword@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;
?>
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
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;
?>