doushao1087
2018-11-20 12:59
浏览 157
已采纳

如何将curl响应值插入数据库

I generated AWBNoSeries with help of below code in link :

ReturnMessage":"Successful","ReturnCode":100,"AWBNoGenRequestedDateTime":"20-11-2018 11:46:35","BatchID":"UQpyj61049","AWBNoSeries":["14104918100000","14104918100001",

<?php

$data = 
array (
  'BusinessUnit' => 'ECOM',
  'ServiceType' => 'FORWARD',
  'BatchID'   =>   'UQpyj61049',
);


$url = "http://114.143.206.69:803/StandardForwardStagingService.svc/GetAWBNumberGeneratedSeries";
$data = json_encode($data);

$headers = array(
    "Content-Type: application/json", 
    "XBKey: QGfMthH1",
);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($curl, CURLOPT_VERBOSE, true);

$curl_response = curl_exec($curl);
curl_close($curl);
echo $curl_response;

$con = mysqli_connect("localhost","root","","do_management4"); 

$result = mysqli_query($con,"SELECT * FROM ecomexpress_awb"); 

//$id = $_POST['id']; 

$sql = $con->query('INSERT INTO ecomexpress_awb(awb) values ()'); 

mysqli_close($con); 

?>

Now i need to save these below AWBNoSeries in mysql table ecomexpress_awb & in column awb with each AWBNo in different row....

14104918100000","14104918100001","14104918100002","14104918100003"

I am not getting what i need to pass in values () in above query....

1条回答 默认 最新

相关推荐 更多相似问题