问题如题目,请大家帮忙解决下,我是刚刚开始学cURL的.最好能带上测试案例附加源码!!谢谢!!!!

解决方案 »

  1.   

    http://curl.haxx.se/libcurl/c/post-callback.html
    这里有一个现成的教程,自己用google翻译一下。
      

  2.   


    额,我需要一个PHP版的!那个C版的看的比较艰难 
      

  3.   

    <?php
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
        curl_setopt($ch, CURLOPT_URL, _VIRUS_SCAN_URL);
        curl_setopt($ch, CURLOPT_POST, true);
        // same as <input type="file" name="file_box">
        $post = array(
            "file_box"=>"@/path/to/myfile.jpg",
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
        $response = curl_exec($ch);
    ?>