Jump to content

Linking to individual twitter posts


Riboflavin1

Recommended Posts

Hi all, I have used this script to pull twitter updates to my website and it works great: http://www.inkplant.com/code/pull-twitter-feed-into-your-site.php

 

I was wondering if anyone could help me modify it so that it links to the individual twitter posts such as: http://twitter.com/user/status/4528454817693440

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/219173-linking-to-individual-twitter-posts/
Share on other sites

Would it be something like this then?

 

<?php

//connect to database
mysql_connect("localhost", "user_twit", "password") or die(mysql_error());

//connect to specific table
mysql_select_db("user_twitter") or die(mysql_error());

$result = mysql_query("SELECT * FROM `twitter` WHERE `screen_name`='username' AND `hidden` != 'y' ORDER BY `time` DESC LIMIT 3");
while ($row = mysql_fetch_array($result)) {
    $text = stripslashes($row['text']);
    $time = $row['time'];
    $id = $row['id'];
    echo "<li><a href=\"http://twitter.com/username/status/".$id."\">".$text."</a></li>\n" ;
}

?>

 

Edit: Yup, seems to be working :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.