码迷,mamicode.com
首页 > Web开发 > 详细

php curl post josn + header

时间:2019-01-13 21:08:29      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:var   pre   div   cal   field   charset   json   var_dump   gis   

<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

标签:var   pre   div   cal   field   charset   json   var_dump   gis   

原文地址:https://www.cnblogs.com/hellowzd/p/10263826.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!