맞춤형 미니 애플리케이션을위한 트위터 공유가 포함 된 플래시 앱이 있습니다.bit.ly php api - '&'기호 다음에 querystring 매개 변수를 잘라내시겠습니까?
PHP 쿼리 문자열을 통해 전달 된 flashvars를 사용하여 매우 간단하게 사용자 정의 색상과 메시지를 미니 응용 프로그램에 전달할 수 있습니다.
물론 문제는 동적 URL을 줄이기 위해 php에 bit.ly api를 사용하고 플래시로 해시 URL을 전달하기 위해 트위터 URL 길이입니다.
잘 작동하는 함수를 작성했지만 처음 '&'기호 다음에 두 번째 쿼리 문자열 매개 변수를 잘라내는 기능이 있습니까?
그래서, 예를 들면, URL을 실행하는 다음 함수
http://bit.ly/i4kfj0 단축 얻는다 '= & twittertest 메시지 http://s46264.gridserver.com/apps/soundgirl/fbwall.php?colour=red'어떤 , 파싱 될 때 http://s46264.gridserver.com/apps/soundgirl/fbwall.php?colour=red
두 번째 쿼리 문자열 매개 변수가 잘립니다. 누구든지이 일을 막을 수있는 방법을 알고 있습니까?
감사합니다.
<?php
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);
?>
감사합니다, 나는 투표를하려 그러나 명백하게 나는 15 명의 담당자를 필요로한다. 이제 잘됩니다. 귀하의 도움에 감사드립니다. – digitalpencil
Xcode에서 작동하지 않습니다. – Swati