Presentation is loading. Please wait.

Presentation is loading. Please wait.

Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project.

Similar presentations


Presentation on theme: "Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project."— Presentation transcript:

1 Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project.

2 Reports Identify 5 cookies: owner & data How accurate was the geolocation program for you using …

3 Capturing tweets Background: request from senior project student I found a wrapper for the official Application Programming Interface (API) http://twitter.slawcup.com/twitter.class.phps http://thinkvitamin.com/code/how-to-get-started-with-the- twitter-api/ –I downloaded and then uploaded to my site –NOTE: I did not bother to study/understand the whole thing! ASSIGNMENT for you (you can work in teams): build your own twitter capture program. –Probably will require you to work with incomplete understanding (like I did).

4 Client - Server HTML5 JavaScript program to run on the client, invokes php program to run on the server, which accesses twitter programs

5 Another Purchase server Was not necessary, but I have had to put other php programs on socialsoftware.purchase.edu so I put these there, also. Why? –Server programs can … change programs, files on server, so CTS restricts certain operations. reading & writing & uploading files

6 Quick overview php A php program (script) on server –takes input from the html script that invoked it, most typically form input –does something: often invoking SQL on a database, and here invoking programs on twitter –creates html to send back to browser, to be interpreted in normal way.

7 NOTICE Upload to server and test. NO test on your own computer –unless…. You can't see the source of a php program, but only the source of the html it produces

8 php quirks Variables start with $ -> used for associative array components –similar to dot notation in JavaScript. More when we do JSON. (dot) is used for concatenation Use combination of single and double quotation, along with \ for producing strings with quotation marks. Go into and out of php. Everything 'outside of php' is part of the html document sent to the browser.

9 My twitter example(s) html presents a form. Invokes php script php uses wrapper functions to get data –NOT instantaneous. Need to set up to wait for data php uses data to produce (echo) html.

10 Capture tweets http://socialsoftware.purchase.edu/jeanine. meyer/twittersearch.htmlhttp://socialsoftware.purchase.edu/jeanine. meyer/twittersearch.html http://socialsoftware.purchase.edu/jeanine. meyer/twittersearchfilter.htmlhttp://socialsoftware.purchase.edu/jeanine. meyer/twittersearchfilter.html Note: Danielle's program is much nicer than mine! Note: she wanted the program to repeat…

11 <?php header('Content-type: text/html; charset=utf-8'); require_once 'class.twitter.php'; ?> Finding tweets for a specified tag function init() { window.setTimeout(function() {location.reload(true);},5000); };

12 <?php $t = new twitter; $tag = $_GET['key']; print "Searching for $tag..."; $s = new summize; $data = $s->search($tag); $data = $data->results; ?> <?php foreach($data as $d){ $st2= substr($d->text,0,2); $st1 = substr($d->text,0,1); if ((strcasecmp($st2,"RT") !=0) && (strcasecmp($st1,"@")!=0)) { //case insensitive compare to RT ?>

13 profile_image_url; ?>" alt="" /> @\2 ', $d->text); ?> by from_user; ?>"> from_user; ?> created_at; ?> from source); ?>

14 Homework Create new folder on your students.purchase.edu site download from moodle and then upload the class.twitter.php file plus my two files test NOW make changes! –you may always search for the same thing or put in a choice or …. –you can change what is displayed. You also can search and find other twitter helper programs.


Download ppt "Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project."

Similar presentations


Ads by Google