Call the Sina Weibo short address API code php code
Urls [0]-> url_short;} function expandSinaUrl ($ short_url) {$ apiKey = 'xxxxxxxxxx'; // replace it with your APPID $ apiUrl =' https://api.weibo.com/2/short_url/expand.json?source= '. $ ApiKey. '& url_short = '. $ short_url; $ curlObj = curl_init (); curl_setopt ($ curlObj, CURLOPT_URL, $ apiUrl); curl_setopt ($ curlObj, Taobao, 1); curl_setopt ($ curlObj, Taobao, 0); curl_setopt ($ curlObj, CURLOPT_HEADER, 0); curl_setopt ($ curlObj, CURLOPT_HTTPHEADER, array ('content-type: application/json ')); $ response = curl_exec ($ curlObj); curl_close ($ curlObj); $ json = json_decode ($ response); return $ json-> urls [0]-> url_long ;} function compute URL ($ long_url) {$ apiKey = 'xxxxxxxxx'; // replace it with your APPID $ apiUrl =' https://api.weibo.com/2/short_url/shorten.json?source= '. $ ApiKey. '& url_long = '. $ long_url; $ response = file_get_contents ($ apiUrl); $ json = json_decode ($ response); return $ json-> urls [0]-> url_short ;} function expandurl ($ short_url) {$ apiKey = 'xxxxxxxxxxx'; // replace it with your APPID $ apiUrl =' https://api.weibo.com/2/short_url/expand.json?source= '. $ ApiKey. '& url_short = '. $ short_url; $ response = file_get_contents ($ apiUrl); $ json = json_decode ($ response); return $ json-> urls [0]-> url_long;}?>