2012-04-11 9 views
1

これを解析するのに苦労しています。私はaccess_credentialsにキーを与える方法を知っています:$ account ['twitter'] - > access_credentials ;.この返された値をPHPで解析する方法

しかし、私はoauth_tokenまたはoauth_token_secretを取得できないようです。これを取得してセッション変数に保存できるようにする必要があります。

[twitter] => stdClass Object 
    (
     [id] => 1 
     [third_party_uid] => 
     [access_credentials] => {"oauth_token":"xxxx","oauth_token_secret":"xxx","user_id":"1234","screen_name":"user_1"} 
     [mds_user_id] => 15 
     [type] => 
     [provider] => Twitter 
    ) 

助けてください。

+0

がそれを解決するため、単に結果をjson_decodeするために必要な^ _ ^ –

答えて

5

これはJSON文字列のようです。それをデコード:

$credentials = json_decode($account['twitter']->access_credentials, true); 
echo $credentials['oauth_token']; 
2
$ac = json_decode($twitter->access_credentials); 
echo $ac['oauth_token'];