SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Posting links to twitter

    Hi Guys!

    Does anyone know how using the Twitter API to post a status update along with a link?

    I am using the following class/code (i've tried emailing the author, but no response):

    PHP Code:
    /* Twitter Plugin */
    require_once(DIR.'/includes/twitter/tmhOAuth.php');
    require_once(
    DIR.'/includes/twitter/tmhUtilities.php');
                
    $tmhOAuth = new tmhOAuth(array(
        
    'consumer_key'    => 'secret',
         
    'consumer_secret' => 'secret',
          
    'user_token'      => 'secret',
          
    'user_secret'     => 'secret'));
                    
    $twitter_content $_POST['job_title'].' - '.strip_tags($_POST['job_description']).' '.SITEURL.'/'.$this->settings['company_directory'].'/'.$jobinfo['company_url'].'/'.$jobinfo['job_url'];
    $code $tmhOAuth->request('POST'$tmhOAuth->url('1/statuses/update'), array('status' => $twitter_content'wrap_links' => 'true'));
                
    if(
    $code == 200) {
    tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
    } else {
    tmhUtilities::pr($tmhOAuth->response['response']);

    Please help, im at a dead end.

    Thanks in advance.

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Isn't it just a case of sending the URL in the text? And Twitter will automatically make it clickable?

    Or am I missing something?

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Immerse View Post
    Isn't it just a case of sending the URL in the text? And Twitter will automatically make it clickable?

    Or am I missing something?
    Hmmm that's what I thought, but it doesn't seem to be the case - weird.

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Just a guess, but did you try setting $twitter_content with some concrete text values, less than 140 chars? Maybe it is twitter clients that enforce the 140 limit proir to sending the request off?

  5. #5
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Just a guess, but did you try setting $twitter_content with some concrete text values, less than 140 chars? Maybe it is twitter clients that enforce the 140 limit proir to sending the request off?
    It must just be the URL i'm using as it's an IP address...also, do you know how to post bit links like they have here:
    http://twitter.com/#!/simplysalesjobs

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I'm sorry, I have no experience of this API and cannot think of anything else to suggest.

    Apart from as I said, send in some concrete values and then keep adding complexity (url, shortened url and so on) until you discover the reason for the failure.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •