- 论坛徽章:
- 0
|
原帖由 xiao_ye 于 2006-4-30 11:40 发表
请教各位大哥怎么用curl上传文件啊!我都整了一天没搞定:
以下是用CURL提交表单的代码:那位大哥能帮我修改一下
...
- <?php
- $uploaded_file = "test.gif";
- //请求页面
- $address=array(
- 'street'=>$_POST['street'],
- 'city'=>$_POST['city'],
- 'upfile'=>"@$uploaded_file";
- );
- $ch = curl_init("http://211.151.109.51/work/test1.php");
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $address);
- $ret = curl_exec($ch);
- curl_close($ch);
- ?>
复制代码 |
|