zoukankan      html  css  js  c++  java
  • curl发送文件

    简介:这是curl发送文件的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=325729' scrolling='no'> 通过PHP的CURL,可以的发送文件:
    // URL on which we have to post data
    $url = "http://localhost/tutorials/post_action.php";
    // Any other field you might want to catch
    $post_data['name'] = "khan";
    // File you want to upload/post
    $post_data['file'] = "@c:/logs.log";

    // Initialize cURL
    $ch = curl_init();
    // Set URL on which you want to post the Form and/or data
    curl_setopt($ch, CURLOPT_URL, $url);
    // Data+Files to be posted
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    // Pass TRUE or 1 if you want to wait for and catch the response against the request made
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // For Debug mode; shows up any error encountered during the operation
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    // Execute the request
    $response = curl_exec($ch);

    // Just for debug: to see response
    echo $response;

    发送多个文件也一样:
    $post_data['alian_error_log'] = "@c:/alian_app_error.log";
    $post_data['myapp_error_log'] = "@c:/myapp_error.log";

    “curl发送文件”的更多相关文章 》

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/325729.html pageNo:13
  • 相关阅读:
    CSS3--box-shadow
    C#快捷键
    c#基础3
    C#基础2
    C#基础
    javascript 字符串总结
    javasrcipt中的for in 循环
    javascript复习总结
    结构体数组排序
    ArrayList集合排序
  • 原文地址:https://www.cnblogs.com/ooooo/p/2252355.html
Copyright © 2011-2022 走看看