Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot post tweet with a link #42

Closed
reliq opened this issue Oct 25, 2014 · 8 comments
Closed

Cannot post tweet with a link #42

reliq opened this issue Oct 25, 2014 · 8 comments

Comments

@reliq
Copy link
Collaborator

reliq commented Oct 25, 2014

Not sure what is happening. No matter the length of the url or tweet message itself, it results in error 186 : Status is over 140 characters.

public function tweet($message = null) 
    {   
        $message    = ($message) ? $message : 'Check out '. Str::limit($this->title, 10, '...') .'!';
        $status     = $message. ' '. URL::route('project', urlencode($this->title));
        $status     = Twitter::linkify($status);

        return Twitter::postTweet(
            array(
                'status' => $status,
                'format' => 'json'
            )
        );
    }

What am I doing wrong?

@reliq reliq changed the title Cannot seem to post a tweet with a link. Cannot post tweet with a link Oct 25, 2014
@thujohn
Copy link
Collaborator

thujohn commented Oct 25, 2014

The linkify method is for output only.
It replaces @user by a link...

You need to check the length of $status before posting.

@reliq
Copy link
Collaborator Author

reliq commented Oct 25, 2014

OK. I tried it. It just posts the url as text though.

@thujohn
Copy link
Collaborator

thujohn commented Oct 25, 2014

What I do is simple :

$status = 'My status';
$status = substr($tweet, 0, 119).' '.$url;
Twitter::postTweet(['status' => $status]);

@reliq
Copy link
Collaborator Author

reliq commented Oct 26, 2014

Okay. I'll give that a try.

@reliq
Copy link
Collaborator Author

reliq commented Oct 26, 2014

Thanks. It works now.

@reliq reliq closed this as completed Oct 26, 2014
@reliq
Copy link
Collaborator Author

reliq commented Mar 15, 2020 via email

@actuallyakash
Copy link

Thanks for your reply.

It's working. I was sending the localhost virtual URL which doesn't work on Twitter. Replaced it with the remote URL and everything's working and Great library indeed.

@reliq
Copy link
Collaborator Author

reliq commented Mar 15, 2020

No worries. Happens to the best of us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants