curl-and-php
how can i handle with "<url> malformed".
Date: Mon, 27 Jun 2005 16:56:29 +0900
hello,
I got an error code "<url> malformed", when I exec file upload script like this.
Is it impossible to post not only file data but other parameters at
the same time?
<?php
$url = "https://www.example.co.jp/test.cgi";
$pass = "aaaaaaa:bbbbbb";
$input_name ="up_file";
$posts = array(
"mode" => $mode,
$input_name => "@" . $file_name,
);
curl_fileupload($url, $pass, $posts);
function curl_fileupload($uri, $passwd, $posts){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$uri);
curl_setopt($ch, CURLOPT_HTTPAUTH,"CURLAUTH_BASIC");
curl_setopt($ch, CURLOPT_USERPWD,$passwd);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $posts);
$result_upload = curl_exec($ch);
if (curl_errno($ch)){
print curl_error($ch);
}else{
print "upload ok.\n";
curl_close($ch);
}
}
?>
-- tany<tanytany_at_gmail.com>Received on 2005-06-27