Try not urlencode()ing the text of the tweet. Abraham ------------- Abraham Williams | Hacker Advocate | abrah.am <http://abrah.am>Just launched from Answerly <http://answerly.com>: InboxQ<http://inboxq.com>for Chrome @abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am This email is: [ ] shareable [x] ask first [ ] private.
On Tue, Feb 22, 2011 at 14:30, Mike Jones <[email protected]> wrote: > Does anyone know why I get a bunch of "+" symbols instead of spaces > when I use this code that shoots my intranet posting to my twitter > account? > > <? > function tweet($status){ > // Insert your keys/tokens > $consumerKey = ''; > $consumerSecret = ''; > $OAuthToken = '-'; > $OAuthSecret = ''; > > require 'twitteroauth.php'; > > $oAu = new TwitterOAuth($consumerKey, $consumerSecret, $OAuthToken, > $OAuthSecret); > $oAu->post('statuses/update', array('status' => "$status")); > } > > function make_jmp_url($url,$login,$appkey,$format = 'xml',$version = > '2.0.1') { > //create the URL > $jmp = 'http://api. /shorten?version='. > $version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='. > $appkey.'&format='.$format; > > $response = file_get_contents($jmp); > > if(strtolower($format) == 'json') > { > $json = @json_decode($response,true); > return $json['results'][$url]['shortUrl']; > } > else //xml > { > $xml = simplexml_load_string($response); > return 'http://j.mp/'.$xml->results->nodeKeyVal->hash; > } > } > > $tweet = ''; > > $longURL = 'url' . $row->id; > $shortURL = make_jmp_url($longURL, 'admin', '', 'json'); > > $tweet .= urlencode( $row->title ); > > if (strlen($tweet) > 119) { > // shorten status update to fit in 140 with URL > $tweet = substr($tweet, 0, 116 ) . '...'; > } > > $tweet .= ' - '; > $tweet .= $shortURL; > > tweet($tweet); > > > ?> > > -- > Twitter developer documentation and resources: http://dev.twitter.com/doc > API updates via Twitter: http://twitter.com/twitterapi > Issues/Enhancements Tracker: > http://code.google.com/p/twitter-api/issues/list > Change your membership to this group: > http://groups.google.com/group/twitter-development-talk > -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk
