您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
三六零分类信息网 > 南平分类信息网,免费分类信息发布

PHP CURL 执行 Authorization 请求

2026/2/4 13:12:43发布9次查看
php curl 扩展可以帮助我们快速实现http请求。 在使用豆瓣oauth登录接口时,我们需要发送这样的http request 请求: get /v2/user/~me http/1.1host: https://api.douban.comauthorization: bearer a14afef0f66fcffce3e0fcd2e34f6ff4 在命令行中我们这样执行
php curl 扩展可以帮助我们快速实现http请求。
在使用豆瓣oauth登录接口时,我们需要发送这样的http request 请求:
get /v2/user/~me http/1.1host: https://api.douban.comauthorization: bearer a14afef0f66fcffce3e0fcd2e34f6ff4
在命令行中我们这样执行:
curl https://api.douban.com/v2/user/~me -h authorization: bearer a14afef0f66fcffce3e0fcd2e34f6ff4
php curl 发送 authorization http 请求http curl 执行 post? 方法:
$crl = curl_init();$headr = array();$headr[] = 'authorization: '.$douban_user_name.' '.$accesstoken;curl_setopt($crl, curlopt_httpheader,$headr);curl_setopt($crl, curlopt_post,true);$rest = curl_exec($crl);curl_close($crl);print_r($rest);
如果需要http curl实现get请求,请看下面:
(...)
read the rest of php curl 执行 authorization 请求 (34 words)
© li xi for lixiphp, 2014. |permalink |no comment |add todel.icio.us
post tags: authorization, curl, get, http, post
feed enhanced by better feed from ozh
南平分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product