当前位置:网站首页>PHP curl post length required error setting header header
PHP curl post length required error setting header header
2022-07-25 11:57:00 【hexiaoniao】

The problem is parameters
$param=array(
'grant_type'=>'authorization_code',
'code'=>$code,
'redirect_uri'=>$redirect_uri
);
Change to :
$param="grant_type=authorization_code&code=".$code."&redirect_uri=".$redirect_uri;
$header = [];
array_push($header, "Authorization:Basic " . $base,"Content-type:x-www-form-urlencoded","Content-length:".strlen ($param));
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($curl, CURLOPT_URL, $postUrl);
curl_setopt($curl, CURLOPT_TIMEOUT, 15);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, false);边栏推荐
- Greedy problem 01_ Activity arrangement problem
- [MySQL learning 09]
- Qin long, a technical expert of Alibaba cloud: a prerequisite for reliability assurance - how to carry out chaos engineering on the cloud
- Javescript loop
- Brpc source code analysis (VI) -- detailed explanation of basic socket
- brpc源码解析(三)—— 请求其他服务器以及往socket写数据的机制
- 微星主板前面板耳机插孔无声音输出问题【已解决】
- toString()与new String()用法区别
- 教你如何通过MCU配置S2E为TCP Server的工作模式
- 任何时间,任何地点,超级侦探,认真办案!
猜你喜欢

微信公众号开发 入手

W5500 is in TCP_ In server mode, you cannot Ping or communicate in the switch / router network.

Zero-Shot Image Retrieval(零样本跨模态检索)

Varest blueprint settings JSON

相似矩阵,可对角化条件

Common linear modulation methods based on MATLAB

brpc源码解析(六)—— 基础类socket详解

JS数据类型以及相互转换

阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程

PHP curl post x-www-form-urlencoded
随机推荐
硬件连接服务器 tcp通讯协议 gateway
OSPF综合实验
第4章线性方程组
toString()与new String()用法区别
MIIdock简述
The most efficient note taking method in the world (change your old version of note taking method)
Attendance system based on w5500
The JSP specification requires that an attribute name is preceded by whitespace
"Mqtt protocol explanation and Practice (access to onenet)" of wiznet w5500 series training activities
银行理财子公司蓄力布局A股;现金管理类理财产品整改加速
【高并发】SimpleDateFormat类到底为啥不是线程安全的?(附六种解决方案,建议收藏)
WIZnet嵌入式以太网技术培训公开课(免费!!!)
JS常用内置对象 数据类型的分类 传参 堆栈
图神经网络用于推荐系统问题(IMP-GCN,LR-GCN)
Introduction to pl/sql, very detailed notes
Chapter 4 linear equations
W5500 upload temperature and humidity to onenet platform
JaveScript循环
教你如何通过MCU配置S2E为TCP Server的工作模式
The bank's wealth management subsidiary accumulates power to distribute a shares; The rectification of cash management financial products was accelerated