Kannt sich jemand mit dieser Klasse aus?
Ich habe mir mit Zend_Oauth einen Access-Token von Twitter geholt.
Der Token sieht etwa so aus:
PHP-Code:
var_dump($config['access_token']);
/*
object(Zend_Oauth_Token_Access)#8 (3) {
["_params:protected"]=> array(4) {
["oauth_token"]=> string(50) "123456-blablabla"
["oauth_token_secret"]=> string(41) "mehrblablabla"
["user_id"]=> string(8) "1234567"
["screen_name"]=> string(10) "AccountName"
}
["_response:protected"]=> NULL
["_httpUtility:protected"]=> object(Zend_Oauth_Http_Utility)#9 (0){ }
}
*/
Hier der Code, mit dem ich eine Test-Nachricht posten will (oder einfach nur die Authentifizierung überprüfen will:
PHP-Code:
$twitter = new Zend_Service_Twitter(array(
'username' => 'AccountName',
'accessToken' => $config['access_token'],
));
// verify user's credentials with Twitter
$response = $twitter->account->verifyCredentials();
//oder: send tweet
// $response = $twitter->status->update('TEST NACHRICHT');
Ich bekomme jedoch eine Fehler-Antwort:
PHP-Code:
var_dump($response);
/*
object(Zend_Rest_Client_Result)#16 (2) {
["_sxml:protected"]=> object(SimpleXMLElement)#21 (2) {
["request"]=> string(31) "/account/verify_credentials.xml"
["error"]=> string(27) "Could not authenticate you."
}
["_errstr:protected"]=> NULL
}
*/
Mein Access-Token sieht meiner Meinung nach okay aus. Und haltbar ist der schliesslich auch unbegrenzt.
Hier ein Var_dump des Twitter-Objekts:
PHP-Code:
object(Zend_Service_Twitter)#10 (10) {
["_authInitialized:protected"]=> bool(false)
["_cookieJar:protected"]=> NULL
["_dateFormat:protected"]=> string(16) "D, d M Y H:i:s T"
["_username:protected"]=> NULL
["_password:protected"]=> NULL
["_methodType:protected"]=> NULL
["_methodTypes:protected"]=> array(7) {
[0]=> string(6) "status"
[1]=> string(4) "user"
[2]=> string(13) "directMessage"
[3]=> string(10) "friendship"
[4]=> string(7) "account"
[5]=> string(8) "favorite"
[6]=> string(5) "block"
}
["_localHttpClient:protected"]=> object(Zend_Http_Client)#12 (15) {
["config:protected"]=> array(11) {
["maxredirects"]=> int(5)
["strictredirects"]=> bool(false)
["useragent"]=> string(16) "Zend_Http_Client"
["timeout"]=> int(10)
["adapter"]=> string(31) "Zend_Http_Client_Adapter_Socket"
["httpversion"]=> string(3) "1.1"
["keepalive"]=> bool(false)
["storeresponse"]=> bool(true)
["strict"]=> bool(true)
["output_stream"]=> bool(false)
["encodecookies"]=> bool(true)
}
["adapter:protected"]=> NULL
["uri:protected"]=> NULL
["headers:protected"]=> array(1) {
["accept-charset"]=> array(2) {
[0]=> string(14) "Accept-Charset"
[1]=> string(16) "ISO-8859-1,utf-8"
}
}
["method:protected"]=> string(3) "GET"
["paramsGet:protected"]=> array(0) { }
["paramsPost:protected"]=> array(0) { }
["enctype:protected"]=> NULL
["raw_post_data:protected"]=> NULL
["auth:protected"]=> NULL
["files:protected"]=> array(0) { }
["cookiejar:protected"]=> NULL
["last_request:protected"]=> NULL
["last_response:protected"]=> NULL
["redirectCounter:protected"]=> int(0)
}
["_data:protected"]=> array(0) { }
["_uri:protected"]=> object(Zend_Uri_Http)#13 (9) {
["_username:protected"]=> string(0) ""
["_password:protected"]=> string(0) ""
["_host:protected"]=> string(11) "twitter.com"
["_port:protected"]=> string(0) ""
["_path:protected"]=> string(0) ""
["_query:protected"]=> string(0) ""
["_fragment:protected"]=> string(0) ""
["_regex:protected"]=> array(5) {
["escaped"]=> string(16) "%[[:xdigit:]]{2}"
["unreserved"]=> string(24) "[A-Za-z0-9-_.!~*'()\[\]]"
["segment"]=> string(54) "(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*" ["path"]=> string(66) "(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*)?)+" ["uric"]=> string(56) "(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])" } ["_scheme:protected"]=> string(4) "http"
}
}
Ich weiss nicht, was ich anders machen könnte...
