2 Star 5 Fork 2

教书先生 / PHP-万能Curl方法封装

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

文档

GET访问

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com");

POST访问

echo teacher_curl("https://api.oioweb.cn/api/beian.php",[
    'post'=>[
        'url'=>'qq.com'
    ]
]);

echo teacher_curl("https://api.oioweb.cn/api/beian.php",[
    'post'=>'url=qq.com'
]);

携带Cookie访问

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'cookie'=>'cookie内容'
]);

模拟访问来源Refer

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'refer'=>'https://api.oioweb.cn'
]);

模拟UseaAgent

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'ua'=>'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'
]);

文件上传

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'post'=>[
        'file'=>new CURLFile(realpath("Curl.jpg"))
    ]
]);

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'post'=>new CURLFile(realpath("Curl.jpg"))
]);

获取301跳转地址

echo teacher_curl("https://mmbizurl.cn/s/RNHSo6Dek",[
    'loadurl'=>1
]);

查看返回Header信息

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'header'=>1
]);

设置请求头信息

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'Header'=>[
        'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
accept-encoding: gzip, deflate, br
accept-language: zh-CN,zh;q=0.9
cache-control: max-age=0'
    ]
]);

获取POST以后返回的Header、Body、Cookie内容

echo teacher_curl("https://api.oioweb.cn/api/beian.php?url=qq.com",[
    'post'=>[
        'user'=>123456,
        'pwd'=>123
    ],
    'GetCookie'=>1
]);

最后

还有其他的功能,自己研究吧!还是很强大的!

Comments ( 0 )

Sign in for post a comment

About

自己封装的Curl 方法感觉还是比较强大的,分享出来 spread retract
PHP
MulanPSL-1.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
PHP
1
https://gitee.com/jsxs599928887/PHP_Curl.git
git@gitee.com:jsxs599928887/PHP_Curl.git
jsxs599928887
PHP_Curl
PHP-万能Curl方法封装
master

Search