Jump to content

Posting link to twitter link to ID?


Boxerman

Recommended Posts

Hi guys,

 

I'm using a twitter script that grabs the title and publishings it like so:

 

"Title - Read More at..."

 

I was wondering how i would be able to post the direct link into twitter.. like news.php?id=1 for example.

 

$tweet->post('statuses/update', array('status' => ''.$_POST[title].' - more at MY URL'));

 

This part is in the script to publish automatically when the users adds to the news database.

 

How am i able to get the ID just after the posting of the news?

 

Thanks!

Link to comment
Share on other sites

<?php
/* ---------------------------------------- */
// Change these parameters with your Twitter
// user name and Twitter password.
/* ---------------------------------------- */
$twitter_username ='yourTwitterUserName';
$twitter_psw ='yourTwitterPassword';
/* ---------------------------------------- */

/* Don't change the code beloW
/* ---------------------------------------- */
require('twitterAPI.php');
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); } }
/* ---------------------------------------- */
?> 

 

<!-- Send message to Twitter -->
<?php
if(isset($_POST['twitter_msg']) && !isset($error)){?>
<div class="msg"><?php echo $twitter_status ?></div>
<?php } else if(isset($error)){?>
<div class="msg">Error: please insert a message!</div>
<?php }?>
<p><strong>What are you doing?</strong></p>
<form action="insertTwitterMsg.php" 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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.