Thanks @abraham. Yes problem is resolved. Yes will use code formatting.

Thanks a lot for quick help.

Hi I have been using Abraham Williams’ TwitterOAuth Library for PHP.

It all works perfectly but I’ve notice in the Chrome browser having freshly invoked Chrome there is a problem whereby this line (13) is invoked in callback.php

/* If the oauth_token is old redirect to the connect page. */
if (isset($_REQUEST[‘oauth_token’]) && $_SESSION[‘oauth_token’] !== $_REQUEST[‘oauth_token’]) {
$_SESSION[‘oauth_status’] = ‘oldtoken’;
header(‘Location: ./clearsessions.php’);
}

And therefore the user is returned to the sign in page. If they click Sign in with Twitter a second time, it works.

The same problem doesn’t appear to happen in Firefox 22 or Internet Explorer 10.

If anyone can help it’d be hugely appreciated.

Steve

I want to send a tweet from my application to my subscribers , i want it appears in their profile and I use Abraham Williams library please help me

hello, i am using your library and login and get my friends is working fine.
now i try to use $trends_url = $connection->get(“application/rate_limit_status”);
and i get the object when i use print_r($trends_url); but i want only the value of remaining be printed on screen.
thanks in advance.

Hello @abraham

I need to reply to one particular status. I’m using following functions

public function replyToTwitterStatus($user_id,$status_id,$twitt_reply,$account_name) { $connection= $this->getTwitterConnection($user_id,$account_name); try{ $responce = $this->postApiData('statuses/update', array('status' => $twitt_reply,'in_reply_to_status_id '=> $status_id),$connection); } catch(Exception $e){ echo $message = $e->getMessage(); exit; } }

// this function will handle all post requests
// To post/update twitter data

// To post/update twitter data public function postApiData($request,$params = array(),$connection) { if($params == null) { $data = $connection->post($request); } else {
        $data = $connection->post($request,$params);
    }
            
    // Need to check the error code for post method      
    if($data->errors['0']->code == '88' || $data->errors['0']->message == 'Rate limit exceeded')
    {
        throw new Exception( 'Sorry for the inconvenience,Please wait for minimum 15 mins. You exceeded the rate limit');
    }
    else
    {
        return $data;
    }                  
}

But the issue is that it is not maintaining the conversation view and it is update like normal status for e.g @abraham hello how are you. but that “View conversation” is not coming.

Please do needful
Thanks

I also had this problem but it was because I was starting the authorization at localhost instead of 127.0.0.1

Make sure that $twitt_reply contains an @screen_name of the person the reply is to.

hello @abraham the issue is resolved. The error is i put blank space here 'in_reply_to_status_id '. When i removed it, the issue is resolved.

i want to update twitter tweeds after i post a new tweet,i mean i want to update my div with tweets, so that the new given tweet is show up in my div, i use the following code for that
<?php
// ZET DE STANDAARD TIJDZONE(VERPLICHT VOOR HET OMZETTEN NAAR EEN FORMATTEERBARE STRING)
date_default_timezone_set(‘Europe/Amsterdam’);
if(!empty($_POST[‘tweetpost’])) {
// Set status message
$tweetMessage = $_POST[‘tweetpost’];//‘This is a tweet to my Twitter account via PHP.’;

// Post the status message
$connection->post(‘statuses/update’, array(‘status’ => $tweetMessage));

// from here it stops

$home_timeline1 = $conn->get(‘statuses/home_timeline’);
// ZET DE TWEETS IN BEELD EN ZET DE created_at IN DE FORMAT DIE WE WILLEN HEBBEN.
echo ‘uuuuuuuu’;
//echo ‘

’;
echo ‘ja hoor’;
foreach ($home_timeline1 as $status)
{
echo “”.
"".
"".
"
".$status->user->name."
".
$status->text."
".
date(‘l j M - g:ia’,strtotime($status->created_at)) ."
";
}
//echo ‘
’;

}
?>

above in the code i stated where the code stops, any idea why?. it post my tweet and then i want to read the tweets again and that is not working after status update

@abraham hey how do I get it to display my tweets? where I can customize them? I have the thing fully working, just don’t know how to get it to display my tweets. Any help would be appreciated.

how do I make this script takes the user to follow me ?

<?php

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token[‘oauth_token’], $access_token[‘oauth_token_secret’]);
$content = $connection->get(‘account/verify_credentials’);
$totalFollowers = $content->followers_count;
$cursor = -1;
$qtd = ceil($totalFollowers/100);
for($z=0;$z<$qtd;$z++){
$result = $connection->get(‘statuses/followers’, array(‘cursor’ => $cursor));
$cursor = $result->next_cursor_str;
$user = $result->users;
$total = count($user);
for( $i=0;$i<$total;$i++ ){
$users[] = $user[$i]->screen_name;
}
}
echo “

”;
print_r($users);
echo “
”;
}

?>

$tweets = $twitteroauth->get(“https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=mihirranjan85&count=1”);

This is working perfectly but

$sMessage = “Hi”;
$returnPar = $twitteroauth->post(‘https://api.twitter.com/1.1/statuses/update’, array(‘status’ => $sMessage));
print_r($returnPar);

This is not working and when I print the return the below error -

object(TwitterOAuth)#13 (14) {
[“http_code”]=>
int(401)
[“url”]=>
string(43) “https://api.twitter.com/1.1/statuses/update
[“host”]=>
string(28) “https://api.twitter.com/1.1/
[“timeout”]=>
int(30)
[“connecttimeout”]=>
int(30)
[“ssl_verifypeer”]=>
bool(false)
[“format”]=>
string(4) “json”
[“decode_json”]=>
bool(true)
[“http_info”]=>
array(26) {
[“url”]=>
string(43) “https://api.twitter.com/1.1/statuses/update
[“content_type”]=>
string(10) “text/plain”
[“http_code”]=>
int(401)
[“header_size”]=>
int(285)
[“request_size”]=>
int(465)
[“filetime”]=>
int(-1)
[“ssl_verify_result”]=>
int(0)
[“redirect_count”]=>
int(0)
[“total_time”]=>
float(0.086466)
[“namelookup_time”]=>
float(3.3E-5)
[“connect_time”]=>
float(0.019671)
[“pretransfer_time”]=>
float(0.06537)
[“size_upload”]=>
float(282)
[“size_download”]=>
float(25)
[“speed_download”]=>
float(289)
[“speed_upload”]=>
float(3261)
[“download_content_length”]=>
float(25)
[“upload_content_length”]=>
float(282)
[“starttransfer_time”]=>
float(0.086458)
[“redirect_time”]=>
float(0)
[“certinfo”]=>
array(0) {
}
[“primary_ip”]=>
string(12) “199.16.156.8”
[“primary_port”]=>
int(443)
[“local_ip”]=>
string(14) “107.170.55.163”
[“local_port”]=>
int(41564)
[“redirect_url”]=>
string(0) “”
}
[“useragent”]=>
string(25) “TwitterOAuth v0.2.0-beta2”
[“sha1_method”]=>
object(OAuthSignatureMethod_HMAC_SHA1)#14 (0) {
}
[“consumer”]=>
object(OAuthConsumer)#15 (3) {
[“key”]=>
string(25) “t6ga0V7ZTpj8CBi6PzDIlI81f”
[“secret”]=>
string(50) “GseWlgMVRlysaVCVHrXyRF4RcwjaYfX7EBYB407h3M47hsCtAW”
[“callback_url”]=>
NULL
}
[“token”]=>
object(OAuthConsumer)#16 (3) {
[“key”]=>
string(43) “e9n3EG5e4pxiAzLGmk3u184DxHsO9444x9PRDzJ6tDQ”
[“secret”]=>
string(42) “gPyOyDOuXSOAe2TyX4ktbFcBaLP7EADFBlZh8519Ug”
[“callback_url”]=>
NULL
}
[“http_header”]=>
array(6) {
[“content_length”]=>
string(2) “25”
[“content_type”]=>
string(10) “text/plain”
[“date”]=>
string(29) “Sun, 30 Mar 2014 20:56:29 UTC”
[“server”]=>
string(3) “tfe”
[“set_cookie”]=>
string(100) “guest_id=v1%3A139621298959611980; Domain=.twitter.com; Path=/; Expires=Tue, 29-Mar-2016 20:56:29 UTC”
[“strict_transport_security”]=>
string(17) “max-age=631138519”
}
}

Could anyone help me here?