PHP error missing arguments twitter oauth
Question
I am using the function below
function GetTwitterAvatarOauth($oauthtoken, $oauthsecret){
$to = new TwitterOAuth($consumerkey, $consumersecret, $oauthtoken, $oauthsecret);
$content = $to->OAuthRequest('https://twitter.com/statuses/friends_timeline.xml', array('count' => '50'), 'GET');
$xml = simplexml_load_file("$content");
$imgurl = $xml->profile_image_url;
return $imgurl;
}
When i run the function, providing my token and secret (both valid) i get this;
Warning: Missing argument 3 for GetTwitterAvatarOauth()
Warning: Missing argument 4 for GetTwitterAvatarOauth()
Why would i get that error when i only require 2 arguments for the function?
Solution
It looks like you might have GetTwitterAvatarOauth defined elsewhere.
Also, it looks like the $consumerkey and $consumersecret variables are not defined and this is likely to cause you problems also.
If those variables are global, try adding
global $consumerkey, $consumersecret;
before creating the TwitterOAuth object.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow