Welcome to Geeklog, Anonymous Friday, November 08 2024 @ 09:59 pm EST

Geeklog Forums

Can geeklog update my Twitter?


ITDiver

Anonymous
Hey
Can it?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I'm afraid not, although it would probably make for a cute plugin ...

bye, Dirk
 Quote

ITDiver

Anonymous
Sure would!...( hoping now some Plugin Developers see this thread ) :wink:
 Quote

Guest

Anonymous
Those developers wait for you to see the bounties' page (not wink).
 Quote

Status: offline

Chase

Forum User
Regular Poster
Registered: 03/14/08
Posts: 110
Location:Karachi, Pakistan
there is a service which does that. i am forgetting its name.

It takes your RSS and posts it on your twitter.

ok here it is http://twitterfeed.com/

--
http://TazaKino.com - Pakistani News
Where YOU report the news
 Quote

Status: offline

worldfooty

Forum User
Full Member
Registered: 01/13/09
Posts: 162
Location:Mostly Adelaide, South Australia, Australia

... except twitterfeed doesn't work with Geeklog RSS. It complains:

Please make sure your feed contains valid pubDate entries

It would also accept GUID.

Pretty much a showstopper as far as I can see. No idea whether it's easy to fix?


 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: worldfooty

No idea whether it's easy to fix?


Easy enough: Make sure you're using a RSS 2.0 feed.

bye, Dirk
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Yes we can.

Create a first static page for your eyes only call sendTwitterMsg (ID) and change username and password in code

Text Formatted Code

function postToTwitter($username,$password,$message){

    $host = "http://twitter.com/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message)));

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);

    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);

    curl_close($ch);

    if($resultArray['http_code'] == "200"){
         $twitter_status='Your message has been sended! <a href="http://twitter.com/'.$username.'">See your profile</a>';
    } else {
         $twitter_status="Error posting to Twitter. Retry";
    }
        return $twitter_status;
}

/* ---------------------------------------- */
// Change these parameters with your Twitter
// user name and Twitter password.
/* ---------------------------------------- */
$twitter_username ='username';
$twitter_psw ='password';
/* ---------------------------------------- */

/* Don't change the code belove
/* ---------------------------------------- */

if(isset($_POST['twitter_msg'])){
$twitter_message=$_POST['twitter_msg'];
if(strlen($twitter_message)<1){ $error=1; } else { $twitter_status=postToTwitter($twitter_username, $twitter_psw, $twitter_message); } }
/* ---------------------------------------- */

 


Then create a second static page still for your eyes only with this code and change url to point at your first page

Text Formatted Code

echo '<h2>Post a message on Twitter</h2>';

if(isset($_POST['twitter_msg']) && !isset($error)){
echo '<div class="msg"><?php echo $twitter_status ?></div>';
} else if(isset($error)){
echo '<div class="msg">Error: please insert a message!</div>';
 }
echo '<p><strong>What are you doing?</strong></p>' .
'<form action="url_to_my_insertTwitterMsg_page" method="post">' .
'<input name="twitter_msg" type="text" id="twitter_msg" size="40" maxlength="140" />' .
'<input type="submit" name="button" id="button" value="post" />' .
'</form>';


and now tell the world what you are doing now from this second page.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Hopefully someone would take the aforementioned Twitter API for a plugin that uses functions PLG_itemSaved & PLG_itemDeleted (e.g. function plugin_itemsaved_twitter & plugin_itemdeleted_twitter). That way there'll be neither a need for a middleman site nor relying on RSS feeds. The plugin would be similar to XMLSitemap.
 Quote

ITDiver

Anonymous
This is great! very cool.
I´m getting an error. When Click the post, I get this: http://www.mysite.no/url_to_my_insertTwitterMsg_page . Am I missing something?
 Quote

ITDiver

Anonymous
Quote by: ITDiver

This is great! very cool.
I´m getting an error. When Click the post, I get this: http://www.mysite.no/url_to_my_insertTwitterMsg_page . Am I missing something?



My bad...I found what I was doing wrong, not pointing to my first page. Now I get this error.
atal error: Call to undefined function curl_init() in D:\Sitepath\plugins\staticpages\functions.inc(1189) : eval()'d code on line 5
Error in my_thread_global_end(): 2 threads didn't exit
 Quote

ITDiver

Anonymous
The only thing different I´m doing is that I had to call the first static page for sendTwitterMsg_no (ID). Could this be the issue?

Thanks for any help here.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
You need cURL

In order to use PHP's cURL functions you need to install the » libcurl package. PHP requires that you use libcurl 7.0.2-beta or higher. In PHP 4.2.3, you will need libcurl version 7.9.0 or higher. From PHP 4.3.0, you will need a libcurl version that's 7.9.8 or higher. PHP 5.0.0 requires a libcurl version 7.10.5 or greater.


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

worldfooty

Forum User
Full Member
Registered: 01/13/09
Posts: 162
Location:Mostly Adelaide, South Australia, Australia

Thanks Ben, looks good.

But since I've already set up with Twitterfeed, I guess I'll just use that for now. I didn't realise the RSS version I was using was so old and that I just had to go into the options on Content Syndication and change it to RSS 2.0.

I then just had to be patient for Twitterfeed and Twitter to re-check and refresh.

 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Oops! I realise ITDiver maybe need to post automaticaly stories to twitter, so my code is not usefull in this case.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Guest

Anonymous
You're supposed to use OAuth and not actual password.
 Quote

ITDiver

Anonymous
Quote by: cordiste

Oops! I realise ITDiver maybe need to post automaticaly stories to twitter, so my code is not usefull in this case.

::Ben



Well..I really like this as well. I helps just to do all from one place so the code is very usefull to me. Just have to get the cURL to work. :-)

Thanks
 Quote

ITDIver

Anonymous
Quote by: Guest

You're supposed to use OAuth and not actual password.



What do you mean by this????

 Quote

Guest

Anonymous
I meant the aforementioned API code that included a password. Twitter's API includes something called OAuth to prevent having to include a password in one's code. That's why twitterfeed, for example, doesn't need to know your password anymore.

Actualy, Twitter plans to eventually simply disable codes that use passwords. Read their OAuth FAQ.
 Quote

All times are EST. The time is now 09:59 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content