Ciao.
Il codice riportato in fondo alla pagina funziona benone con le nuove api 1.1 di twitter.
Il problema è quando voglio recuperare informazioni di account o tweet specifici.

Se io modifico la riga di codice che richiama le api da:

Codice PHP:
$url "https://api.twitter.com/1.1/statuses/user_timeline.json"
a (esempio)

Codice PHP:
$url "https://api.twitter.com/1.1/statuses/show.json?id=210462857140252672; 
ricevo il seguente errore:

stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Could not authenticate you [code] => 32 ) ) )


SOTTO IL CODICE CHE CODICE CHE FUNZIONA CORRETTAMENTE

Codice PHP:
function buildBaseString($baseURI$method$params) {
    
$r = array();
    
ksort($params);
    foreach(
$params as $key=>$value){
        
$r[] = "$key=" rawurlencode($value);
    }
    return 
$method."&" rawurlencode($baseURI) . '&' rawurlencode(implode('&'$r));
}


function 
buildAuthorizationHeader($oauth) {
    
$r 'Authorization: OAuth ';
    
$values = array();
    foreach(
$oauth as $key=>$value)
        
$values[] = "$key=\"" rawurlencode($value) . "\"";
    
$r .= implode(', '$values);
    return 
$r;
}


$url "https://api.twitter.com/1.1/statuses/user_timeline.json";


$oauth_access_token "YOURVALUE";
$oauth_access_token_secret "YOURVALUE";
$consumer_key "YOURVALUE";
$consumer_secret "YOURVALUE";


$oauth = array( 'oauth_consumer_key' => $consumer_key,
                
'oauth_nonce' => time(),
                
'oauth_signature_method' => 'HMAC-SHA1',
                
'oauth_token' => $oauth_access_token,
                
'oauth_timestamp' => time(),
                
'oauth_version' => '1.0');


$base_info buildBaseString($url'GET'$oauth);
$composite_key rawurlencode($consumer_secret) . '&' rawurlencode($oauth_access_token_secret);
$oauth_signature base64_encode(hash_hmac('sha1'$base_info$composite_keytrue));
$oauth['oauth_signature'] = $oauth_signature;


// Make Requests
$header = array(buildAuthorizationHeader($oauth), 'Expect:');
$options = array( CURLOPT_HTTPHEADER => $header,
                  
//CURLOPT_POSTFIELDS => $postfields,
                  
CURLOPT_HEADER => false,
                  
CURLOPT_URL => $url,
                  
CURLOPT_RETURNTRANSFER => true,
                  
CURLOPT_SSL_VERIFYPEER => false);


$feed curl_init();
curl_setopt_array($feed$options);
$json curl_exec($feed);
curl_close($feed);


$twitter_data json_decode($json);