【发布时间】:2018-12-22 18:26:57
【问题描述】:
伙计们如何从卷曲响应中删除不需要的数据,如双双引号和字符串(126)我只需要 URL,我得到了这个卷曲响应:
我只需要普通网址请帮助我已经尝试了很多事情但没有好的结果代码如下:
<?php
$url_send ="https://www.mydomainxyz.co/supply_api/surveys/offer?";
function sendPostData($url, $post){
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_USERAGENT,'Content-type: application/json');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "api_token=eca8c17xxxxxxxxx486ec8a7271&user_identifier=80xxxxxx9203");
$jsonStr = curl_exec($ch);
curl_close($ch);
$json = json_decode($jsonStr, true);
var_dump($json['offer_url']);
}
echo " " . sendPostData($url_send, $str_data);
?>
【问题讨论】:
标签: php arrays json string curl