php 解析 querystring,php - bit.ly php api - 在'&'符号后切断querystring参数? - 堆栈内存溢出...

我有一个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);

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值