PHP - Twitter Api Date Issues
For some reason the time is always staying the same throughout the listing tweets even when there's posts with different times. What am I doing wrong?
function getTwitterStatus($userid, $x) { $url = "http://twitter.com/statuses/user_timeline/$userid.xml?count=$x"; $xml = simplexml_load_file($url) or die("could not connect"); foreach ($xml->status as $status) { $text .= "<tr>"; $text .= "<th>" . date("m/d/Y - g:ia", strtotime($xml -> status[0] -> created_at)); "</th>"; $text .= "<td class=\"full\">" . $status -> text . "</td>"; $text .= "<td><img src=\"images/ball_grey_16.png\" class=\"block cr-help\" alt=\"\" title=\"Twitter Message\"/></td>"; } echo $text; } Similar TutorialsThis topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=322255.0 Im trying to make a php program that will grab all the user's tweets they have ever done.. I'm using curl to request the twitter page and scrape the html. It looks as though the maximum amount of tweets I can get is 20, which is the amount on the initial first page. There is some script that loads another 20 tweets once I scroll to the bottom of the page... Does anyone know how to make the page automatically load a certain amount so I can scrape more than the first 20 at once. I'm trying to write a function that'll give me the days of the week of any submitted date. This keep returning 1/30/2011 even though I am submitting 1/05/2011 (the Monday should be 1/03/2011)...I know it's incomplete I'm just trying to get the Monday right now Code: [Select] function getWeekDays($date) { //convert string to date $thisdate = date($date); $dow = idate('w', mktime(0,0,0,$thisdate)); if ($dow == 1) { $monday = date('m/d/Y', mktime(0,0,0, date('m'), date('d', $thisdate), date('Y'))); } else if ($dow == 2) { $monday = date('m/d/Y', mktime(0,0,0, date('m'), date('d', $thisdate) - 1, date('Y'))); } else if ($dow == 3) { $monday = date('m/d/Y', mktime(0,0,0, date('m'), date('d', $thisdate) - 2, date('Y'))); } else if ($dow == 4) { $monday = date('m/d/Y', mktime(0,0,0, date('m'), date('d', $thisdate) - 3, date('Y'))); } else if ($dow == 5) { $monday = date('m/d/Y', mktime(0,0,0, date('m'), date('d', $thisdate) - 4, date('Y'))); } $weekarray = array($thisdate); return $weekarray; } I'm having some trouble understanding how to use date and time when updating my database. The table is already populated with Date and Time fields in date and time format. I need to update the table based on the date and time, but I can't make it work. I tested all the variables and they are being sent correctly. I'm pretty sure the problem lies in how I'm trying to match the Date and Time fields with $dateID and $timeID in the WHERE part of the query, but I'm not sure how to fix that! Code: [Select] <?php include("opendatabase.php"); $size = count($_POST['player1']); $i=0; $thisyear = date("Y"); while ($i < $size) { $dateID = $_POST['date'][$i]; $timeID = $_POST['time'][$i]; $player1 = ($_POST['player1'][$i]); $player2 = ($_POST['player2'][$i]); $player3 = ($_POST['player3'][$i]); $player4 = ($_POST['player4'][$i]); $player5 = ($_POST['player5'][$i]); mysql_query(" UPDATE Daysheets$thisyear SET Player1='$player1', Player2='$player2', Player3='$player3', Player4='$player4', Player5='$player5' WHERE Date = '$dateID' AND Time = '$timeID' "); $i++; } header("Location: /teetimes/publicteetimes.php?teetimedate=$dateID"); mysql_close($con) ?>Any help appreciated! I should also mention that whenever I run this query it erases anything that was previously entered in the database except the date and time columns... Hi everyone, I have a basic calendar that I am trying to change to highlight the current date. I have got the current date highlighted using an if else statement inside a while clause, however, the issue arises when I use the forward/previous links to go to a different month - the same day is highlighted on those months as well. Here is the code snippet in question (the entire code is below): while( $day_num <= $days_in_month ) { if(date('d') != $day_num) { echo "<td> $day_num </td>"; $day_num++; $day_count++; } // display today's date else { echo "<td class=\"today\"> $day_num </td>"; $day_num++; $day_count++; } My question is how do I get this calendar to display the current date, just on the current month. I assume there is something I am missing when it comes to handling the date(s) correctly, but what? Any help is appreciated. Thanks, kaiman Full code: // gets today's date $date = time () ; // puts the day, month, and year in seperate variables $day = date('d', $date) ; $month = (int) ($_GET['month'] ? $_GET['month'] : date('m')); $year = (int) ($_GET['year'] ? $_GET['year'] : date('Y')); // generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year) ; // get the month name $current_month = date('F', $first_day) ; // determine what day of the week the first day of the month falls on $day_of_week = date('D', $first_day) ; // determine blank days before start of month switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } // determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year) ; // determine next month $next_month_link = '<a href="?month='.($month != 12 ? $month + 1 : 1).'&year='.($month != 12 ? $year : $year + 1).'">>></a>'; // determine previous month $previous_month_link = '<a href="?month='.($month != 1 ? $month - 1 : 12).'&year='.($month != 1 ? $year : $year - 1).'"><<</a>'; // start building the table echo " <table border=0 width=294>\n"; echo " <tr>\n"; // display month and year echo " <th> $previous_month_link </th>\n"; echo " <th colspan=4> $current_month $year </th>\n"; echo " <th> $next_month_link </th>\n"; echo " </tr>\n"; // display days of week echo " <tr>\n"; echo " <td width=42>S</td>\n"; echo " <td width=42>M</td>\n"; echo " <td width=42>T</td>\n"; echo " <td width=42>W</td>\n"; echo " <td width=42>T</td>\n"; echo " <td width=42>F</td>\n"; echo " <td width=42>S</td>\n"; echo " </tr>\n"; // counts the days in the week $day_count = 1; echo " <tr>\n"; // display blank days while ( $blank > 0 ) { echo " <td></td>\n"; $blank = $blank-1; $day_count++; } // sets the first day of the month to 1 $day_num = 1; // count the days in the month and display them while( $day_num <= $days_in_month ) { if(date('d') != $day_num) { echo "<td> $day_num </td>"; $day_num++; $day_count++; } // display today's date else { echo "<td class=\"today\"> $day_num </td>"; $day_num++; $day_count++; } // make sure we start a new row every week if ($day_count > 7) { echo " </tr>\n"; echo " <tr>\n"; $day_count = 1; } } // finish calendar while ( $day_count >1 && $day_count <=7 ) { echo " <td>\n"; echo " </td>\n"; $day_count++; } echo " </tr>\n"; echo " </table>\n"; I'm working on a project that has a lot of different timezone options, and all I have from the users is their UTC offset. After weeks of doing tweaks, I come to new issues every time I add something, one would think it would be a lot easier to just get the correct time and day :) The latest issue is that when I try to rewrite a date to a better fomat, it disregards the GMT offset. Like this: 4/14/19, 12:00 PM GMT+2 (=$date) becomes ... 14-04-2019 10:00 when using this code: $bp_date_to_format = date_create_from_format('Y-m-d\TH:i:sP', $date); echo date_format($bp_date_to_format, 'd-m-Y H:i'); I figured it would just rewrite the format, keeping the exact time. It isn't. We do have all these sorts of localization functions as well, but because there doesn't seem to be one single standard (each 3rd party API connection we have uses its own default datetime format so it seems). // Remove UTC Text $UTC_offset = str_replace('UTC', '', $timezone); // Get Offset in Minutes if (stripos($UTC_offset, ':') !== false) { // Calculate seconds from offset list($hours, $minutes) = explode(':', $offset); $seconds = $hours * 60 * 60 + $minutes * 60; } else { $seconds = $UTC_offset * 60 * 60; } // Get User timezone name from seconds $timezone = timezone_name_from_abbr('', $seconds, 1); if ($timezone === false) { $timezone = timezone_name_from_abbr('', $seconds, 0); } // Set new TZ return date_default_timezone_set($timezone);
Isn't there any "one way"solution that can be used? It's confusing to say the least.
Cheers. Hey, I'm using a script which allows you to click on a calendar to select the date to submit to the database. The date is submitted like this: 2014-02-08 Is there a really simple way to prevent rows showing if the date is in the past? Something like this: if($currentdate < 2014-02-08 || $currentdate == 2014-02-08) { } Thanks very much, Jack Hello! I have a twitter button. But I would like to have a form button's action to activate the "tweet/share" link. Why? Because I want to record in mySQL database the fact that someone has in fact clicked the link to tweet. How I was thinking about doing... But really have no idea is like so. <form action="tweet.php" method="POST"> <input type="button" name="tweet" value="ip address" /> </form> then in the tweet.php I would have php insert the gathered IP address (ive got this part working with a geocoder class) into the database as confirmation. Then the php code would execute the hyperlink / java which is this: <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://mycontent.com" data-count="horizontal" data-via="person-to-tweet-at">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> Activating the link as if someone where to click the link, but automatically. Basically I am looking for a way to record who clicks the Twitter button. Any guidance on this topic would be much appreciated. By using twitter api, i'm trying to get latest trends. I need to take trends name and creation time of the list. Can you help me to obtain the values from the array? Thank you This code doesn't work. Code: [Select] <?php $jsonurl = 'http://api.twitter.com/1/trends/44418.json'; $json = file_get_contents($jsonurl,0,null,null); $json_output = json_decode($json); foreach ( $json_output->trends as $trend ) { echo "{$trend->name}\n"; } ?> Does anyone know how to cache Tweets as to not reach the API rate limit? I am using the Twitter-provided widget to display multiple profiles on a website, but the API hits the limit of 150 per hour. Is there any way to cache the Tweets and still use this widget? Or does anyone know of a good widget that caches, or simple code? If anyone knows, please explain in newbie terms. Thanks a lot! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=348183.0 Good day Campers!
Having spent the better part of my day trawling the internet for an answer I have gotten nowhere so have come to you lovely people for help.
I found a nice little tutorial on PHP gang that would allow me to update my twitter feed from my website using PHP and OAuth.
I set up my twitter app with no issues and generated the API keys. Set the App to 'read/write' permissions and then regenerated the keys
The app is marked to "Allow this application to be used to Sign in with Twitter"
The issue is that when I click the little button to sign in to twitter, the page redirects but displays the generic "Cannot connect to Twitter" error message that has been defined in the code. I do not get asked to "Allow" the script to connect to twitter like it seems to do in the demo.
The PHPGang solution has 4 bits of script so I'm wondering if it has something to do with this as I understand the Abrahams script has slightly more so I do wonder if something is missing. I'm not sure. One of the main problems I am facing is that I have never actually done this before so I don't know where I have gone wrong or what I am even looking for help wise......
I have the following scripts:
callback.php
<?php /** * Take the user when they return from Twitter. Get access tokens. * Verify credentials and redirect to based on response from Twitter. */ session_start(); require_once('oauth/twitteroauth.php'); require_once('config.php'); if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) { $_SESSION['oauth_status'] = 'oldtoken'; header('Location: ./destroysessions.php'); } $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']); //save new access tocken array in session $_SESSION['access_token'] = $access_token; unset($_SESSION['oauth_token']); unset($_SESSION['oauth_token_secret']); if (200 == $connection->http_code) { $_SESSION['status'] = 'verified'; header('Location: ./index.php'); } else { header('Location: ./destroysessions.php'); } ?>config.php <?php /** * @file * A single location to store configuration. */ define('CONSUMER_KEY', 'MY CONSUMER KEY'); define('CONSUMER_SECRET', 'MY SECRECT CONSUMER KEY'); define('OAUTH_CALLBACK', 'URL OF WHERE I AM REDIRECTING TO'); ?>destroysessions.php <?php /** * @file * Clears PHP sessions and redirects to the connect page. */ /* Load and clear sessions */ session_start(); session_destroy(); /* Redirect to page with the connect to Twitter option. */ header('Location: ../index.php'); ?>index.php <?php require_once('oauth/twitteroauth.php'); require_once('config.php'); if(isset($_POST["status"])) { $status = $_POST["status"]; if(strlen($status)>=130) { $status = substr($status,0,130); } $access_token = $_SESSION['access_token']; $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); $connection->post('statuses/update', array('status' => "$status")); $message = "Tweeted Sucessfully!!"; } if(isset($_GET["redirect"])) { $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); $request_token = $connection->getRequestToken(OAUTH_CALLBACK); $_SESSION['oauth_token'] = $token = $request_token['oauth_token']; $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret']; switch ($connection->http_code) { case 200: $url = $connection->getAuthorizeURL($token); header('Location: ' . $url); break; default: echo '<div class="par">Could not connect to Twitter. Refresh the page or try again later.</div>'; } exit; } if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { echo '<a href="./index.php?redirect=true"><img src="./images/lighter.png" alt="Sign in with Twitter"/></a>'; } else { echo "<a href='destroysessions.php'>Logout</a><br>"; echo '<div class="par">'.$message.'<div> <form action="index.php" method="post"> <input type="text" name="status" id="status" placeholder="Write a comment...."> <input type="submit" value="Post On My Wall!" style="padding: 5px;"> </form>'; } ?>Now, I am unsure if there is anything wrong with the API keys I have generated or if there is something missing. Is there anyone who can point me in the right direction or offer some advice on where to turn? Thanks! Edited by lauren_etherington, 04 September 2014 - 10:36 AM. Does anybody have any recommendations for PHP scripts to pull in a Twitter feed? I've tried several but each seem to just give me error messages! I basically just need a PHP alternative so that the tweets can be read by search engines. Thanks. If you look at the botton of http://getminecraft.net/ you see my latest tweets. The problem is that it shows http://getminecraft.net/%22http://twitter.com/PC_Gamer%22 instead of the original twitter url, that results to a wrong url and wrong site. How can I fix it? so it shows the original twitter url. Here is the script: <?php $username = "getminecraft"; $prefix = ""; $suffix = ""; $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1"; function parse_feed($feed) { $stepOne = explode("<content type=\"html\">", $feed); $stepTwo = explode("</content>", $stepOne[1]); $tweet = $stepTwo[0]; $tweet = str_replace("<", "<", $tweet); $tweet = str_replace(">", ">", $tweet); return $tweet; } $twitterFeed = file_get_contents($feed); echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix); ?> I was wondering if you could help me.
I am currently trying to use the 'GET users/show' command in the Twitter API, however it is not working.
Can anyone see where I am going wrong?
<?php include "library/twitteroauth.php"; ?> <?php $consumer = "key"; $consumersecret = "key"; $accesstoken = "key"; $accesstokensecret = "key"; $twitter = new TwitterOAuth($consumer, $consumersecret, $accesstoken, $accesstokensecret); $tweets = $twitter->get('https://api.twitter.com/1.1/users/lookup.json?screen_name=twitterapi,twitter'); ?> <html> <head> <meta charset ="UTF-8" /> <title>Twitter Search</title> </head> <body> <form action="" method="post"> <label>Search: <input type="text" name ="keyword"/> </form> <?php if ( isset($_POST['keyword'])){ $tweets = $twitter->get('https://api.twitter.com/1.1/users/lookup.json?screen_name='.$_POST['keyword']. ''); foreach($tweets as $tweet){ foreach ($tweet as $t){ echo ($t->text); } } } ?> </body> </html> I'm running a site where people can post confessions, there's an option to share confession to twitter but it doesn't work properly.
When you click on twitter icon there is a window opening, you need to log in to twitter and then you have your tweet you want to share which looks like this:
Confessions.ie - Irish Anonymous Confessions Confession: I did it! http://www.confessio...e.php?page=view
problem is that url, "http://www.confessio...e.php?page=view" - it doesn't correspond to actual post, then when clicked it shows "-1" and that's it.
normal post url's would be something like this:
http://www.confessio...w&confession=18
http://www.confessio...w&confession=15
http://www.confessio...w&confession=12
Website is: confessions dot ie
and here's the code that I think contains error somewhe
<?php $confId = $_GET['confession']; $viewIp = $_SERVER['REMOTE_ADDR']; // Get the Full Page URL $pageURL = (isset($_SERVER['HTTPS']) ? "https" : "http")."//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $count = 0; $hasViewed = ''; $msgBox = ''; // Get the File Uploads Folder from the Site Settings $uploadsDir = $set['uploadPath']; // Check if Moderation is On $moderated = $set['moderation']; // Check if Profanity Filter is On $filterProfanity = $set['useFilter']; $chkViews = mysqli_query($mysqli,"SELECT 'X' FROM views WHERE confessId = ".$confId." AND viewIp = '".$viewIp."' LIMIT 1"); $hasView = mysqli_num_rows($chkViews); if ($hasView == 0) { $hasViewed = '0'; } $viewDate = date("Y-m-d H:i:s"); if ($hasViewed == '0') { $stmt = $mysqli->prepare(" INSERT INTO views( confessId, viewIp, viewDate ) VALUES ( ?, ?, ? ) "); $stmt->bind_param('sss', $confId, $viewIp, $viewDate ); $stmt->execute(); } // Add New Comment if (isset($_POST['submit']) && $_POST['submit'] == 'addComment') { // Validation if($_POST['commentText'] == "") { $msgBox = alertBox($commentsReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if($_POST['answer'] == "") { $msgBox = alertBox($captchaCodeReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if ($_POST['hole'] != '') { $msgBox = alertBox($commentsErrorMsg, "<i class='fa fa-times-circle'></i>", "danger"); $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; } else { $commentText = htmlentities($_POST['commentText']); $usersId = $mysqli->real_escape_string($_POST['usersId']); if ($_POST['firstName'] == '') { $firstName = null; } else { $firstName = $mysqli->real_escape_string($_POST['firstName']); } $commentDate = date("Y-m-d H:i:s"); // Moderation Check if ($moderated == '1') { $isActive = '0'; } else { $isActive = '1'; } // Check if the poster is a logged in user if (isset($_SESSION['userId'])) { $user = $_SESSION['userId']; } else { $user = '0'; } if(strtolower($_POST['answer']) == $_SESSION['thecode']) { $stmt = $mysqli->prepare(" INSERT INTO comments( confessId, userId, firstName, comments, commentDate, isActive, commentIp ) VALUES ( ?, ?, ?, ?, ?, ?, ? ) "); $stmt->bind_param('sssssss', $confId, $user, $firstName, $commentText, $commentDate, $isActive, $viewIp ); $stmt->execute(); if ($moderated == '1') { $msgBox = alertBox($commentsSavedMsg1, "<i class='fa fa-check-square'></i>", "success"); } else { $msgBox = alertBox($commentsSavedMsg2, "<i class='fa fa-check-square'></i>", "success"); } // Clear the Form of values $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; $stmt->close(); } else { $msgBox = alertBox($captchaErrorMsg, "<i class='fa fa-warning'></i>", "warning"); } // If the confession is posted by a user if ($usersId != '0') { $uemail = "SELECT userEmail, recEmails FROM users WHERE userId = ".$usersId; $remail = mysqli_query($mysqli, $uemail) or die('-1' . mysqli_error()); $e = mysqli_fetch_assoc($remail); $userEmail = $e['userEmail']; $recEmails = $e['recEmails']; // If the users has opted in to receive notifications if ($recEmails == '1') { // Send out the email in HTML $installUrl = $set['installUrl']; $siteName = $set['siteName']; $siteEmail = $set['siteEmail']; $subject = $newCommentEmailSubject; $message = '<html><body>'; $message .= '<h3>'.$subject.'</h3>'; $message .= '<hr>'; $message .= '<p>'.nl2br($commentText).'</p>'; $message .= '<hr>'; $message .= '<p>'.$newCommentEmail1.' '.$pageURL.'</p>'; $message .= '<p>'.$subscribeEmail3.'<br>'.$siteName.'</p>'; $message .= '</body></html>'; $headers = "From: ".$siteName." <".$siteEmail.">\r\n"; $headers .= "Reply-To: ".$siteEmail."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($userEmail, $subject, $message, $headers); } } } } // Get Confession $select = "SELECT confessId, userId, (IFNULL(firstName, '')) AS firstName, confessText, DATE_FORMAT(postDate,'%b %d %Y %h:%i %p') AS postDate, hasImage, isActive, (SELECT COUNT(*) FROM views WHERE views.confessId = confessions.confessId ) as totalViews, (SELECT COUNT(*) FROM likes WHERE likes.confessId = confessions.confessId ) as totalLikes, (SELECT COUNT(*) FROM dislikes WHERE dislikes.confessId = confessions.confessId ) as totalDislikes FROM confessions WHERE confessId = ".$confId; $res = mysqli_query($mysqli, $select) or die('-1' . mysqli_error()); $row = mysqli_fetch_assoc($res); if ($row['totalViews'] == '1') { $viewText = $singleViewText; } else { $viewText = $multipleViewsText; } $shareURL = $set['installUrl'].'page.php?page=view&confession='.$row['confessId']; $googleURL = $set['installUrl']; // Get Comments $qry = "SELECT commentId, confessId, (IFNULL(firstName, '')) AS fName, comments, DATE_FORMAT(commentDate,'%b %d %Y %h:%i %p') AS commentDate, isActive FROM comments WHERE confessId = ".$confId." AND isActive = 1 ORDER BY commentId DESC"; $results = mysqli_query($mysqli, $qry) or die('-2'.mysqli_error()); include('includes/header.php'); ?> <section id="main-container"> <div class="container"> <?php if ($msgBox) { echo $msgBox; } ?> <div class="confessbox"> <div class="confession"> <?php if ($row['hasImage'] == '1') { // Get Image $sqlStmt = "SELECT uploadId, confessId, uploadUrl FROM uploads WHERE confessId = ".$confId; $sqlres = mysqli_query($mysqli, $sqlStmt) or die('-2'.mysqli_error()); $col = mysqli_fetch_assoc($sqlres); //Get File Extension $ext = substr(strrchr($col['uploadUrl'],'.'), 1); $imgExts = array('gif', 'GIF', 'jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG', 'tiff', 'TIFF', 'tif', 'TIF', 'bmp', 'BMP'); if (in_array($ext, $imgExts)) { echo '<p class="mb-20"><img alt="'.$confImageAlt.'" src="'.$uploadsDir.$col['uploadUrl'].'" class="img-responsive" /></p>'; } } ?> <p> <i class="fa fa-quote-left"></i> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($row['confessText']))); } else { echo nl2br(clean($row['confessText'])); } ?> <i class="fa fa-quote-right"></i> </p> <input type="hidden" id="confessId" name="confessId_<?php echo $count; ?>" value="<?php echo $row['confessId']; ?>" /> <div class="confession-footer"> <div class="likes"> <span class="label label-confess first liked"> <a href="" id="likeIt<?php echo $row['confessId']; ?>" class="likeIt_<?php echo $count; ?> text-success"> <i class="fa fa-smile-o"></i> <span id="likesVal_<?php echo $count; ?>"><?php echo $row['totalLikes']; ?></span> </a> </span> </div> <div class="dislikes"> <span class="label label-confess disliked"> <a href="" id="dislikeIt<?php echo $row['confessId']; ?>" class="dislike_<?php echo $count; ?> text-danger"> <span id="dislikesVal_<?php echo $count; ?>"><?php echo $row['totalDislikes']; ?></span> <i class="fa fa-frown-o"></i> </a> </span> </div> <span class="label label-confess"><?php echo timeago($row['postDate']); ?></span> <span class="label label-confess last"><?php echo $row['totalViews'].' '.$viewText; ?></span> <a href="https://twitter.com/intent/tweet?text=<?php echo $set['siteName']; ?>%20Confession:%20<?php echo ellipsis($row['confessText'],65); ?>%20&url=<?php echo $shareURL; ?>" class="btn btn-tw btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $twitterShareTooltip; ?>"> <i class="fa fa-twitter"></i> </a> <a href="https://plus.google.com/share?url=<?php echo $googleURL; ?>" class="btn btn-gp btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $googleShareTooltip; ?>"> <i class="fa fa-google-plus"></i> </a> <span class="label label-confess last hasVoted text-danger"><strong><?php echo $onlyVoteOnceText; ?></strong></span> <div class="comments"> <?php if ($row['firstName'] != '') { ?> <span class="label label-confess last"><?php echo $postedByText.' '.clean($row['firstName']); ?></span> <?php } else { ?> <span class="label label-confess last"><?php echo $postedByAnon; ?></span> <?php } ?> </div> </div> <div class="clearfix"></div> </div> </div> <?php if(mysqli_num_rows($results) > 0) { ?> <hr /> <div class="commentbox"> <?php while ($rows = mysqli_fetch_assoc($results)) { ?> <div class="comment"> <p> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($rows['comments']))); } else { echo nl2br(clean($rows['comments'])); } ?> </p> <?php if ($rows['fName'] != '') { ?> <span class="label label-comments"><?php echo clean($rows['fName']).' '.$commentedText.' '.timeago($rows['commentDate']); ?></span> <?php } else { ?> <span class="label label-comments"><?php echo $anonCommented.' '.timeago($rows['commentDate']); ?></span> <?php } ?> </div> <?php } ?> </div> <?php } ?> <hr /> <form action="" method="post" class="comment-form mt-30"> <div class="form-group"> <textarea class="form-control" name="commentText" id="commentText" rows="4" required="" placeholder="<?php echo $addCommentsField; ?>"><?php echo isset($_POST['commentText']) ? $_POST['commentText'] : ''; ?></textarea> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" name="firstName" placeholder="<?php echo $firstNamePlaceholder; ?>" value="<?php echo isset($_POST['firstName']) ? $_POST['firstName'] : ''; ?>"> </div> </div> <div class="col-md-4"></div> <div class="col-md-4"> <div class="row"> <div class="col-md-4"> <img src="includes/captcha.php" id="captcha" data-toggle="tooltip" data-placement="left" class="pull-right" title="<?php echo $captchaCodeTooltip; ?>" /> </div> <div class="col-md-8"> <div class="form-group"> <input type="text" class="form-control" name="answer" required="" maxlength="6" placeholder="<?php echo $captchaCodeTooltip; ?>"> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-8"> <p><?php echo $commentsQuip1; ?><strong><?php echo $isOn; ?></strong>. <?php echo $commentsQuip2; ?> <strong><?php echo $filtered; ?></strong>.</p> </div> <div class="col-md-4"> <input type="hidden" name="hole" id="hole" /> <input type="hidden" name="usersId" value="<?php echo $row['userId']; ?>" /> <button type="input" name="submit" value="addComment" class="btn btn-fessup btn-lg pull-right btn-icon"><i class="fa fa-check-square-o"></i> <?php echo $saveCommentsBtn; ?></button> </div> </div> </form> </div> </section> I have a form which lets the user put in the URL to their twitter account. When the enter their URL I am trying to create a screen scraping script that scrapes that page to get basic information like their twitter name and number of tweets. I'm not sure how I am going to do this, I don't think there is a twitter API for this so I may have to use something like cURL. I was just wondering if anyone has done this and could give me any advice about the best method? Thanks for any help Hi, I have seen on website linked in connector When user click on image next to Name or Email then their linked in information shown in pop up. In my project I want to implement functionality. Any idea or suggestion regarding Twitter or Linkedin Connector implementation. Thanks. I have built a small database which use the Twitter API to extract data from the listed members XML files (http://twitter.com/users/show.xml?screen_name=username) and it works well, but since the database makes several calls everytime a page loads I get kicked out very quickly, even with a small memberbase. So I wonder what solution would help with this problem? I have considered dropping the XML data into the database and saving each XML file on the server, but I am not sure what solution would be best? This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=307126.0 |