Curl模拟Http工具类:HttpCurl.class.php

WBOY
Release: 2016-06-20 12:50:47
Original
1190 people have browsed it

Curl模拟Http工具类

可实现模拟GET、POST、POST上传文件.

How To Use.

require 'HttpCurl.class.php';// GET请求HttpCurl::get('http://api.example.com/');// GET请求, 并json_decode返回的数组HttpCurl::get('http://api.example.com/?a=123&b=456', 'json');// POST请求HttpCurl::post('http://api.example.com/?a=123', array(    'abc'=>'123',     'efg'=>'567'));HttpCurl::post('http://api.example.com/', '这是post原始内容', 'json');// POST请求, 文件上传HttpCurl::post('http://api.example.com/', array(    'file1'=>'@/data/sky.jpg',    'file2'=>'@/data/bird.jpg',));
Copy after login

项目主页:http://www.open-open.com/lib/view/home/1439448225411

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template