当前位置:网站首页>php curl post Length Required 错误设置header头
php curl post Length Required 错误设置header头
2022-07-25 11:02:00 【hexiaoniao】

问题在于参数
$param=array(
'grant_type'=>'authorization_code',
'code'=>$code,
'redirect_uri'=>$redirect_uri
);
改成:
$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);边栏推荐
- 任何时间,任何地点,超级侦探,认真办案!
- Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees
- 30套中国风PPT/创意PPT模板
- What is the difference between session and cookie?? Xiaobai came to tell you
- W5500通过上位机控制实现调节LED灯带的亮度
- 贪心问题01_活动安排问题
- 【USB设备设计】--复合设备,双HID高速(64Byte 和 1024Byte)
- SQL language (6)
- 各种控件==PYQT5
- cookie and session
猜你喜欢

Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees

【leetcode刷题】

Brpc source code analysis (VIII) -- detailed explanation of the basic class eventdispatcher

教你如何通过MCU将S2E配置为UDP的工作模式

Miidock Brief

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

Talking about Devops monitoring, how does the team choose monitoring tools?

brpc源码解析(一)—— rpc服务添加以及服务器启动主要过程

矩阵的特征值和特征向量

Teach you how to configure S2E as the working mode of TCP client through MCU
随机推荐
Breadth first traversal (problems related to sequence traversal of graphs and binary trees)
模型部署简述
Greedy problem 01_ Activity arrangement problem
JS运算符
There is no sound output problem in the headphone jack on the front panel of MSI motherboard [solved]
已解决 Files‘ name is invalid or does not exist (1205)
W5500 adjusts the brightness of LED light band through upper computer control
Make a reliable delay queue with redis
动态规划问题03_最大子段和
toString()与new String()用法区别
W5500 multi node connection
Common linear modulation methods based on MATLAB
cookie and session
Attendance system based on w5500
Fillet big killer, use filter to build fillet and wave effect!
【IMX6ULL笔记】--内核底层驱动初步探究
第4章线性方程组
Hardware peripherals =maixpy3
Use three.js to realize the cool cyberpunk style 3D digital earth large screen
Maskgae: masked graph modeling meets graph autoencoders