function getWeiboData()
{
$count = 15;
// 参数source后面输入你的授权号
$url = "https://api.weibo.com/2/statuses/home_timeline.json?source=123456789&count=".$count."&page=1";
echo $url.'
';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
// 设置是否显示header信息 0是不显示,1是显示 默认为0
//curl_setopt($curl, CURLOPT_HEADER, 0);
// 设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。0显示在屏幕上,1不显示在屏幕上,默认为0
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// 要验证的用户名密码
curl_setopt($curl, CURLOPT_USERPWD, "username:password");
$data = curl_exec($curl);
curl_close($curl);
$result = json_decode($data, true);
echo '
';<br> print_r($result);<br> echo '