1
我發現bit.ly的API在PHP中短鏈接,但我需要一個循環,在那裏將被縮短的鏈接陣列...PHP - 使用bit.ly鏈接API短陣
因此,舉例來說,我有數組:
Array
(
[0] => http://longlink.com/1.php
[1] => http://longlink.com/2.php
[2] => http://longlink.com/3.php
[3] => http://longlink.com/4.php
[4] => http://longlink.com/5.php
)
,我需要總之它給新的數組是這樣的:
Array
(
[0] => http://bit.ly/...
[1] => http://bit.ly/...
[2] => http://bit.ly/...
[3] => http://bit.ly/...
[4] => http://bit.ly/...
)
我已經包含微小的API(HERE)和usnig PHP代碼,我可以短一個鏈接
$bitly = new bitly('username', 'apikey');
echo $bitly->shorten('http://longlink.com/1.php');
但你能告訴我,如何縮短這個數組嗎?謝謝!
過度用和RP是正確的,沒有縮短許多API,所以你需要循環你的長URL。 –