RE:how do i update my twitter automatically

update twitter acc automatically when theres new update in database.

Page 1 of 1

5 Replies - 2796 Views - Last Post: 24 July 2010 - 10:49 PM Rate Topic: -----

#1 Guest_mooiee*


Reputation:

RE:how do i update my twitter automatically

Posted 24 July 2010 - 08:33 AM

hi.
i am currently having this problem such as i want to update my twitter account automatically such as when there's update in my database. so whenever there's new thing being inserted into my database, my twitter should automatic update too. so how do i go about doing this?

thanks a lot.


regards,
mooiee
Is This A Good Question/Topic? 0

Replies To: RE:how do i update my twitter automatically

#2 ShaneK  Icon User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Re: RE:how do i update my twitter automatically

Posted 24 July 2010 - 08:53 AM

Look into the Twitter API.

Of course, there's no need to reinvent the wheel.

Yours,
Shane~

This post has been edited by ShaneK: 24 July 2010 - 08:54 AM

Was This Post Helpful? 2
  • +
  • -

#3 Guest_mooiee*


Reputation:

Re: RE:how do i update my twitter automatically

Posted 24 July 2010 - 09:26 AM

Hi. i did read through it too. and i found some open source code but it cant seem work for my case.
<?php

mysql_connect(“localhost”, “USERNAME”, “PASSWORD”) or die(‘Could not connect to database’);

mysql_select_db(“DATABASE”) or die(‘Could not select database’);

$result = mysql_query (“SELECT * FROM tweets ORDER BY RAND() LIMIT 1″);

while($row = mysql_fetch_array($result)){

$tweet = “$row[tweet]“;

sendTweet($tweet);

}

function sendTweet($msg){

$username = ‘TWITTER-USER-NAME’;

$password = ‘TWITTER-PASS’;

$url = ‘http://twitter.com/statuses/update.xml’;

$curl_handle = curl_init();

curl_setopt($curl_handle, CURLOPT_URL, “$url”);

curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);

curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl_handle, CURLOPT_POST, 1);

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, “status=$msg”);

curl_setopt($curl_handle, CURLOPT_USERPWD, “$username:$password”);

$buffer = curl_exec($curl_handle);

curl_close($curl_handle);

if (empty($buffer)) {

echo ‘fail’;

} else {

echo ‘success’;

}

}

?>


basically, this is a to create php and send tweet.
so what i am trying to do is to edit and create a php page to grab information from my database and posting it to my twitter account instead.
but i have no idea whether am i on the right track?
can you please guide me through?
thank you


regards,
mooiee

This post has been edited by CTphpnwb: 24 July 2010 - 10:33 AM
Reason for edit:: Please use Code tags: the <> icon when posting!

Was This Post Helpful? 0

#4 KingCuddles  Icon User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: RE:how do i update my twitter automatically

Posted 24 July 2010 - 10:45 AM

Quote

so what i am trying to do is to edit and create a php page to grab information from my database and posting it to my twitter account instead.


If you mean you want a PHP script to check your database for new posts, and then if it finds any automatically update your twitter status, I would look into using cron jobs.

You could quite easily create one which checks for new posts, and if it finds any new info, posts it to your twitter.
Was This Post Helpful? 0
  • +
  • -

#5 Guest_mooiee*


Reputation:

Re: RE:how do i update my twitter automatically

Posted 24 July 2010 - 09:05 PM

yes. something like what you mean. like whenever there's new detail in database, it will also update Twitter account. but i have no idea on how to link them together? what is cron ? how do i go about doing it?


Thanks a lot

Regards.
mooiee
Was This Post Helpful? 0

#6 no2pencil  Icon User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6585
  • View blog
  • Posts: 30,745
  • Joined: 10-May 07

Re: RE:how do i update my twitter automatically

Posted 24 July 2010 - 10:49 PM

I would suggest using Curl :

http://www.dreaminco...-functionality/
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1