문제

I am generating access_token from FB graph API.

Every thing is working fine and its giving me access_token on call back url

Can anyone tell me how should i get this token for url to use in my php script.

After response url is :

http://www.mysite.com/company/index.php?mod=details#access_token=170791786296375|4c9eaa63ed2bad5ac51662d4-1394587960|4ndIjiCJaAnqLSe8wOo_HaxUC90&expires_in=0

I am trying to get by

$_REQUEST['access_token']

Bu can't get like this way. Can any one help me in this matter?

도움이 되었습니까?

해결책

$access_token = "";
if(preg_match("/access_token=([^&]+)/", $_SERVER['QUERY_STRING'], $matches)) {
    $access_token = $matches[1];
}

or

$access_token = $_REQUEST['mod'];
$access_token = explode("#", $access_token);
$access_token = str_replace("access_token=", "", $access_token[1]);

or something like that

다른 팁

if your doing it this way, you are doing it wrong. You are using the client side methods to send data to the server. You should be using the server side methods.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top