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

php-求一段能用的PHP发送json数据的代码

2024/2/23 15:30:52发布21次查看
phpjson
不要复制粘贴的,网上都不能用
function http_post_data($url, $strjson) {
$ch = curl_init(); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_postfields, $strjson); curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json; charset=utf-8', 'content-length: ' . strlen($strjson)) ); ob_start(); curl_exec($ch); $return_content = ob_get_contents(); ob_end_clean(); $return_code = curl_getinfo($ch, curlinfo_http_code); return array($return_code, $return_content); } 这个啊 什么的试了好多个了
该用户其它信息

VIP推荐

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