post提交json數(shù)據(jù) PHP如何通過Post請(qǐng)求發(fā)送Json數(shù)據(jù)?
PHP如何通過Post請(qǐng)求發(fā)送Json數(shù)據(jù)?Use curl$ch=curluinit()$header[]=“content type:text/XML”//將內(nèi)容類型定義為xmlcurluseto
PHP如何通過Post請(qǐng)求發(fā)送Json數(shù)據(jù)?
Use curl$ch=curluinit()$header[]=“content type:text/XML”//將內(nèi)容類型定義為xmlcurlusetopt($ch,CURLOPTuurl,$URL)//定義表單提交地址curlusetopt($ch,CURLOPTuupost,1)//定義提交類型1:Post;0:getcurlusetopt($ch,CURLOPTuheader,1) //定義是否顯示狀態(tài)。Header 1:顯示;0:不顯示curlsetopt($ch,CURLOPTuhttp Header,$Header)//定義請(qǐng)求類型curlsetopt($ch,CURLOPTureturn transfer,0)//定義是否直接輸出返回流curlsetopt($ch,CURLOPTupostfields,$poststr)//定義提交的數(shù)據(jù),下面是XML文件$res=curlexec($ch)curlClose($ch)//Close