- Notifications
You must be signed in to change notification settings - Fork57
一个轻量级的 PHP 网络操作类, 基于 Curl 封装并实现了 Get | Post | Upload | Download 等常用方法。
License
NotificationsYou must be signed in to change notification settings
wenpeng/curl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PHP-Curl是一个轻量级的网络操作类,实现GET、POST、UPLOAD、DOWNLOAD常用操作,支持方法链写法
对低版本做了向下支持,但建议使用 PHP 5.3 +
composer require wenpeng/curl
useWenpeng\Curl\Curl;
$curl =newCurl;
或者
$curl = Curl::init();
$curl->url(目标网址);
$curl->post(变量名, 变量值)->post(多维数组)->url(目标网址);
$curl->post(多维数组)->file($_FILE字段, 本地路径, 文件类型, 原始名称)->url(目标网址);
$curl->url(文件地址)->save(保存路径);
参考:http://php.net/manual/en/function.curl-setopt.php
$curl->set('CURLOPT_选项', 值)->post(多维数组)->url(目标网址);
// 出错自动重试N次(默认0)$curl->retry(3)->post(多维数组)->url(目标网址);
// 任务结果状态if ($curl->error()) {echo$curl->message();}else {// 任务进程信息$info =$curl->info();// 任务结果内容$content =$curl->data();}
About
一个轻量级的 PHP 网络操作类, 基于 Curl 封装并实现了 Get | Post | Upload | Download 等常用方法。
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.