av手机免费在线观看,国产女人在线视频,国产xxxx免费,捆绑调教一二三区,97影院最新理论片,色之久久综合,国产精品日韩欧美一区二区三区

php語言

php使用curl發(fā)送json格式數(shù)據(jù)實(shí)例

時間:2025-04-20 08:06:53 php語言 我要投稿
  • 相關(guān)推薦

php使用curl發(fā)送json格式數(shù)據(jù)實(shí)例

  文章主要介紹了php使用curl發(fā)送json格式數(shù)據(jù)的實(shí)例,大家參考使用吧。

  復(fù)制代碼 代碼如下:

  $urlcon= 'http://localhost/******.php';

  $data=' {

  "button":[

  {

  "type":"click",

  "name":"今日歌曲",

  "key":"V1001_TODAY_MUSIC"

  },

  {

  "type":"click",

  "name":"歌手簡介",

  "key":"V1001_TODAY_SINGER"

  },

  {

  "name":"菜單",

  "sub_button":[

  {

  "type":"click",

  "name":"hello word",

  "key":"V1001_HELLO_WORLD"

  },

  {

  "type":"click",

  "name":"贊一下我們",

  "key":"V1001_GOOD"

  }]

  }]

  }';

  $host = $urlcon;

  $ch = curl_init();

  $data = 'data='.$data;

  curl_setopt($ch, CURLOPT_POST, 1);

  curl_setopt($ch, CURLOPT_HEADER, 0);

  curl_setopt($ch, CURLOPT_URL,$host);

  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

  echo $output = curl_exec($ch);

  curl_close($ch);

【php使用curl發(fā)送json格式數(shù)據(jù)實(shí)例】相關(guān)文章:

PHP基于CURL進(jìn)行POST數(shù)據(jù)上傳實(shí)例05-31

PHP如何使用curl實(shí)現(xiàn)數(shù)據(jù)抓取02-05

PHP如何使用curl發(fā)送GET和POST請求03-02

PHP基于CURL進(jìn)行POST數(shù)據(jù)上傳實(shí)例方法02-15

PHP curl之操作實(shí)例01-14

在PHP語言中使用JSON04-11

php中curl模擬post請求小實(shí)例06-01

PHP如何用curl發(fā)送GET和POST請求12-15

php數(shù)組轉(zhuǎn)成json格式的方法04-08