Home  >  Article  >  Backend Development  >  Curl模拟Http工具类:HttpCurl.class.php

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

WBOY
WBOYOriginal
2016-06-20 12:50:471183browse

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',));

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

Statement:
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