【发布时间】:2015-02-04 11:04:43
【问题描述】:
我正在调用一个函数来从 3 个不同的来源获取数据。
$returnedData 响应始终是一个数组。如何将所有 3 个响应合并到一个数组中?
function getData($xPostURL,$xToken,$xTokenSecret,$xAccount)
{
$datatopost = array (
"token" => $xToken,
"tokenSecret" => $xTokenSecret,
"account" => $xAccount,
);
$ch = curl_init ($xPostURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnedData = curl_exec ($ch);
echo $returnedData;
}
getData("http://www.example.com/foo.php","","","");
getData("http://www.example.org/bar.php","","","");
getData("http://www.example.net/helloworld.php","","","");
【问题讨论】: