php curl post josn + header
Posted 两只小蜜蜂啊
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php curl post josn + header相关的知识,希望对你有一定的参考价值。
<meta charset="utf8"> <?php ini_set("max_execution_time",1800000); $array = array( ‘123123‘); $i = 0; foreach ($array as $k=>$v){ $i++; echo "<br>".$i."<br>"; $params = array(‘logisticsNo‘=>$v); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://localhost:9080" ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($params)); curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type:application/json‘,‘token:123123‘)); $return = curl_exec($ch); var_dump($return); }
以上是关于php curl post josn + header的主要内容,如果未能解决你的问题,请参考以下文章