http服务-建立一个简单http客户端

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/scylhy/article/details/52200970

http服务-建立一个简单http客户端

使用的开源库是libcurl,它支持很多协议,在这只使用http协议,来实现对http服务器上传文本及图片。
  • libcurl简介
    from wikipedia
    libcurl is a free client-side URL transfer library, supporting FTP, FTPS, Gopher, HTTP, HTTPS, SCP, SFTP, TFTP, Telnet, DICT, the file URI scheme, LDAP, LDAPS, IMAP, POP3, SMTP and RTSP. The library supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, Kerberos, HTTP form-based upload, proxies, cookies, user-plus-password authentication, file transfer resume, and HTTP proxy tunneling.
    The libcurl library is portable. It builds and works identically on many platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HP-UX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Symbian, AmigaOS, OS/2, BeOS, OS X, iOS, Android, Ultrix, QNX Neutrino, BlackBerry Tablet OS and BlackBerry 10,[5] OpenVMS, RISC OS, NetWare and DOS.
    The libcurl library is free, thread-safe and IPv6 compatible. Bindings are available for more than 40 languages, including C/C++, Java, PHP and Python.
    The libcurl library can support SSL/TLS through OpenSSL, GnuTLS, NSS, wolfSSL, mbed TLS, axTLS, QSOSSL on IBM i, Secure Transport on OS X and iOS, and SChannel on Windows.
    from 百度百科
    libcurl主要功能就是用不同的协议连接和沟通不同的服务器~也就是相当封装了的sockPHP 支持libcurl(允许你用不同的协议连接和沟通不同的服务器)。, libcurl当前支持http, https, ftp, gopher, telnet, dict, file, 和ldap 协议。libcurl同样支持HTTPS证书授权,HTTP POST, HTTP PUT, FTP 上传(当然你也可以使用PHP的ftp扩展), HTTP基本表单上传,代理,cookies,和用户认证。

  • libcurl编译、配置
    参考这篇文章

#未完待续

阅读更多
换一批

没有更多推荐了,返回首页