Hi,
I want to post notice once the user authorizes the status.net instance from my
application. I have faced some problems which are as follows:
1. When I make a request for the access token, it gives me 400 error with
Invalid request token or verifier. When I debug this issue and move into the
apioauthaccesstoken.php, i found that verifier was also needed so I add it in
oAuth function "from_consumer_and_token". In this way, it gives me access
token. Please guide me if it is right or not or I was moving in wrong direction.
2. After I get access token, it is saved in 'oauth_application_user' table with
access type=3, what does it means? Now if I am using access token which is
saved in my application sessions(same as in database), it gives me 401 error
"Invalid signature". The code for updae status is
$service_provider = "myurl";
$callback_url = mycallback url';
$consumer = new OAuthConsumer($key, $secret, NULL);
function updateStatus(){
global $sig_method, $key, $secret, $service_provider, $consumer;
$oauth_token = $_SESSION[PREFIX.'acc_oauth_token'];//access token
$oauth_token_secret = $_SESSION[PREFIX.'acc_oauth_token_secret'];//access
token secret
$oauth_verifier = $_SESSION[PREFIX.'oauth_verifier'] ;//oauth verfiier
$statusString = "Test notice from app";
$params = array('status' => $statusString);
$test_token = new OAuthConsumer($oauth_token, $oauth_token_secret);
$acc_req = OAuthRequest::from_consumer_and_token($consumer, $test_token,
"POST", $service_provider."/api/statuses/update.xml", $params,$oauth_verifier);
$acc_req->sign_request($sig_method, $consumer, $test_token);
$resp = curl_get_file_contents($acc_req);
}
function curl_get_file_contents($URLl){
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
$httpcode = curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
if ($httpcode) return array("code" => $httpcode, "contents" => $contents);
else die("Problem connecting host");
}
Please guide me about it. I have post this issue at forum too but no fruitful
result. Also provide me any documentation that tells status.net schema
architecture.
Regards,
Sana Amin
_______________________________________________
StatusNet-dev mailing list
[email protected]
http://lists.status.net/mailman/listinfo/statusnet-dev