How do I use consumer secret and access token secret


#1

I’ve generate the request and header to do post the status in OAuth tool.
I see consumer secret and access token secret, but they are not include in header. I try to execute the code without them.
<?php
echo tweet(“hello world”);
function tweet($str){
$data = array(“include_entities” => true, “status” => $str, “trim_user” => true);
$header = array(
‘Authorization: OAuth oauth_consumer_key=“"’,
'oauth_nonce="
"’,
‘oauth_signature="**********************"’,
‘oauth_signature_method=“HMAC-SHA1”’,
'oauth_timestamp="
"’,
'oauth_token="
************************”’,
‘oauth_version=“1.0”’
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://api.twitter.com/1/statuses/update.json”);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)”);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_COOKIEJAR, “cookie.txt”);
curl_setopt($ch, CURLOPT_COOKIEFILE, “cookie.txt”);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
?>
and the result is
{“error”:“Could not authenticate with OAuth.”,“request”:"/1/statuses/update.json"}
my question, how include them in my code to success the post status ?


#2

Ok