我有一个Flash应用程序,其中包含一个定制的迷你应用程序的Twitter共享。
我使用通过php查询字符串传入的flashvars非常简单地实现了这一点,因此您的自定义颜色和消息将传递给迷你应用程序。
问题当然是twitter的url长度,所以我希望使用bit.ly api for php缩短动态url并将该散列的url传递回flash。
我写了一个函数来做这个工作正常,但它是在第一个'&'符号后切断第二个查询字符串参数?
例如,运行url的以下函数'http://s46264.gridserver.com/apps/soundgirl/fbwall.php?colour=red&message=twittertest'
它正在切断第二个查询字符串参数。 有人知道我可以阻止这种情况发生吗?
谢谢。
function bitly_shorten($url)
{
$username = "modernenglish";
$apikey = "myapikey";
$response = file_get_contents("http://api.bit.ly/v3/shorten?login=$username&apiKey=$apikey&longUrl=$url&format=json");
$response = json_decode($response);
if ($response->status_code == 200 && $response->status_txt == "OK")
{
return $response->data->url;
} else
{
return null;
}
}
$link = urldecode("http://s46264.gridserver.com/apps/soundgirl/fbwall.php?colour=red&message=twittertest");
echo bitly_shorten($link);
?>