当前位置:网站首页>Record a debugging when curl has no return value
Record a debugging when curl has no return value
2022-06-25 12:26:00 【sr_ www】
problem :php curl perform post No return value found
debugging : After direct output, it is found that the code is garbled
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
solve : Transcode acquired data
$output = mb_convert_encoding($output, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');
function post($url, $data = null) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
if ($data) {
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$output = mb_convert_encoding($output, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');
curl_close($ch);
return $output ?: '';
}
$url = 'http://xxx.com/ajax/GetJobInfoByBk.ashx';
$data = [
'JobTypeId' => $code,
];
$res = $this->post($url, $data);
dump($res);
边栏推荐
- Gradle knowledge points
- The network traceroute command is used to determine the path through which IP packets access the destination address.
- Explain AHP in human language (very detailed principle + simple tool implementation)
- An article clearly explains MySQL's clustering / Federation / coverage index, back to table, and index push down
- R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the lrtest function of epidisplay package to perform multiple model
- Why do we do autocorrelation analysis? Explain application scenarios and specific operations
- JS to realize the calculation of discrete aggregation points
- Encapsulation of practical methods introduced by webrtc native M96 basic base module (MD5, Base64, time, random number)
- Why should Apple change objc_ Type declaration for msgsend
- ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
猜你喜欢

Dark horse shopping mall ---6 Brand, specification statistics, condition filtering, paging sorting, highlighting

Pd1.4 to hdmi2.0 adapter cable disassembly.

Actual combat summary of Youpin e-commerce 3.0 micro Service Mall project
![[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?](/img/51/9aceaaeed1f6db7c60685d53477eba.png)
[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?

Explanation of ideas and sharing of pre-processing procedures for 2021 US game D (with pre-processing data code)

SDN system method | 9 Access network

Why do we do autocorrelation analysis? Explain application scenarios and specific operations

Today, I will explain to you what is DFI and its development prospects

flutter常用命令及问题

黑马畅购商城---8.微服务网关Gateway和Jwt令牌
随机推荐
2022 meisai D topic ideas sharing + translation
[oceanbase] Introduction to oceanbase and its comparison with MySQL
Gradle knowledge points
[on]learning dynamic and hierarchical traffic spatiotemporal features with transformer
Kotlin Foundation
Mpai data science platform random forest classification \ explanation of regression parameter adjustment
ARM 立即数
Network related encapsulation introduced by webrtc native M96 basic base module
R语言caTools包进行数据划分、scale函数进行数据缩放、e1071包的naiveBayes函数构建朴素贝叶斯模型
A detour taken by a hardware engineer
Explanation of ideas and sharing of pre-processing procedures for 2021 US game D (with pre-processing data code)
Which securities company's account is better and safer to open
Dark horse shopping mall ---2 Distributed file storage fastdfs
R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用summary函数获取模型汇总统计信息
Redis雪崩、穿透和击穿是什么?
How to open an account for trading futures Shanghai nickel products online
sklearnex 让你的 sklearn 机器学习模型训练快得飞起?
揭秘GaussDB(for Redis):全面对比Codis
Explain factor analysis in simple terms, with case teaching (full)
15、wpf之button样式小记