Vous êtes sur la page 1sur 17

Group 1

Week 5
What have we been at?
Down to tech stuff!
Dan is building the MySQL database.
Brian is creating the HTML and CSS.
Billy is working on the PHP.

Solid product due before final report.
Twitter Feed

PHP Parsing

MySQL Database

HTML Website
Frontend
Daniel Beere
Introduction to Twitter and MySQL

Twitter
Why We Twitter: Understanding
Microblogging Usage and Communities.
Studies Twitter’s Social Network.
User’s talk about daily activities and
seek/share information.
User’s intentions and connections with other
users.
Twitter
A Few Chirps About Twitter.
Detailed characterization of Twitter.
Identifies different classes of Twitter users and
their behaviours.
Geographical patterns and growth.
Current size of the network.
MySQL
MySQL is a relational database management
system (RDBMS) that runs as a server
providing multi-user access to a number of
databases.
Relational: DBMS which data is stored in the
form of tables and the relationship among the
data is also stored in the form of tables.
MySQL Features/Tools
Varchar: is a set of character data of
indeterminate length. Refers to a data type of
a field in a DBMS.
SELECT: Statement that returns a result set of
records from one or more tables.
Unicode: computing industry standard for the
representation of text expressed in writing
systems.

MySQL Features/Tools
Cache/Query Caching: component that
improves performance by storing data
such that future requests for that data can
be served faster.
Database Trigger: automatically executed
in response to certain events on a
particular table in a database. E.g. When a
new record (representing a new worker) is
added to the employees table, new
records should be created also in the
tables of the taxes, vacations, and
Code to Consider
 $host = "testweb2.csis.ul.ie";
 $user = "0867241";
 $pass = "danbeere";
 $db = "0867241";

 $connection = mysql_connect($host,
$user, $pass) or die ("Unable to
connect!");

 mysql_select_db($db) or die ("Unable


to select database!");
Code to Consider
 if ($tokenNo > 0) {
 $condition = "(tag1 = '$tags[0]') OR (tag2 =
'$tags[0]')OR (tag3 = '$tags[0]')OR (tag4 =
'$tags[0]')OR (tag5 = '$tags[0]')";
 for($i=1; $i<sizeof($tags); $i++) {
 $condition .= " OR (tag1 = '$tags[$i]') OR (tag2 =
'$tags[$i]')OR (tag3 = '$tags[$i]') OR (tag4 =
'$tags[$i]') OR (tag5 = '$tags[$i]')";
 }
 $query = "SELECT * FROM videos WHERE $condition";
 }
 else {
 $query = "SELECT * FROM videos";
 }
 $result = mysql_query($query) or die ("Error in
query: $query. ".mysql_error());
William Kennedy
PHP and the Twitter API

Twitter API: Some
Examples
Using the tools jQuery, PHP and the Twitter API
it is possible to parse a twitter feed and
reconstitute it into whatever form you wish.
The Twitter API (in our case) returns data as an
RSS/Atom feed. This feed must be parsed into
chunks of data which can be stored in our
MySQL database and presented on the
website.
API Code
 Twitter Search API Method: search
 Page history last edited by Raffi Krikorian 2 mos ago
 << Back to Twitter API Documentation
  
 search
 Returns tweets that match a specified query.
 method status | report a bug
  
 URL:
 http://search.twitter.com/search.format
  
 Formats: 
 json, atom 
  
 HTTP Method:
 GET
  
 Requires Authentication (about authentication):
 false
  
 API rate limited (about rate limiting):
 1 call per request
 01.<?xml version="1.0" encoding="UTF-8"?>
 02.<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="
http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
 03.  <id>tag:search.twitter.com,2005:search/twitter</id>
 04.  <link type="text/html" rel="alternate" href="http://search.twitter.com/search?q=twitter"/>
 05.  <link type="application/atom+xml" rel="self" href="http://search.twitter.com/search.atom?q=twitter&;lang=en"/>
 06.  <title>twitter - Twitter Search</title>
 07.  <link type="application/opensearchdescription+xml" rel="search" href="http://search.twitter.com/opensearch.xml"/>
 08.  <link type="application/atom+xml" rel="refresh" href="http://search.twitter.com/search.atom?lang=en&
;q=twitter&since_id=1855677271"/>
 09.  <twitter:warning>adjusted since_id, it was older than allowedsince_id removed for pagination.</twitter:warning>
 10.  <updated>2009-05-20T03:54:29Z</updated>
 11.  <openSearch:itemsPerPage>15</openSearch:itemsPerPage>
 12.  <openSearch:language>en</openSearch:language>
 13.  <link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?lang=en&
;max_id=1855677271&page=2&q=twitter"/>
 14.  <entry>
 15.    <id>tag:search.twitter.com,2005:1855677271</id>
 16.    <published>2009-05-20T03:54:29Z</published>
 17.    <link type="text/html" rel="alternate" href="http://twitter.com/nihongotako/statuses/1855677271"/>
 18.    <title>Respond to tgis twitter with a challenge u want to see accomplished in the next video!
 19.www.youtube.com/fitzner123</title>
 20.    <content type="html">Respond to tgis <b>twitter</b> with a challenge u want to see accomplished in the next video!
 21.  
 22.<a href="http://www.youtube.com/fitzner123">www.youtube.com/fitzner123</a></content>
 23.    <updated>2009-05-20T03:54:29Z</updated>
 24.    <link type="image/png" rel="image" href="
http://s3.amazonaws.com/twitter_production/profile_images/217800128/Photo_13_normal.jpg"/>
 25.    <twitter:source><a href="http://twitterfon.net/">TwitterFon</a></twitter:source>
 26.    <twitter:lang>en</twitter:lang>
 27.    <author>
Learning PHP
Not much left to say as far as learning goes.
I have a Lynda DVD ;D
On target so far.

Vous aimerez peut-être aussi