Continue with behavioral marketing. Tweets. - PowerPoint PPT Presentation

About This Presentation
Title:

Continue with behavioral marketing. Tweets.

Description:

Continue with behavioral marketing. Tweets. Reports. Homework: capture tweets project. Reports Identify 5 cookies: owner & data How accurate was the geolocation ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 15
Provided by: Jeanin52
Category:

less

Transcript and Presenter's Notes

Title: Continue with behavioral marketing. Tweets.


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-wi
    th-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
  • -gt 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/t
    wittersearch.html
  • http//socialsoftware.purchase.edu/jeanine.meyer/t
    wittersearchfilter.html
  • Note Danielle's program is much nicer than mine!
  • Note she wanted the program to repeat

11
  • lt?php
  • header('Content-type text/html charsetutf-8')
  • require_once 'class.twitter.php'
  • ?gt
  • lthtmlgt
  • ltheadgtlttitlegtFinding tweets for a specified
    taglt/titlegt
  • ltscriptgt
  • function init()
  • window.setTimeout(function() location.reload(tru
    e),5000)
  • lt/scriptgt lt/headgt

12
  • lt?php
  • t new twitter
  • tag _GET'key'
  • print "Searching for tag..."
  • s new summize
  • data s-gtsearch(tag)
  • data data-gtresults
  • ?gt
  • lt?php foreach(data as d)
  • st2 substr(d-gttext,0,2)
  • st1 substr(d-gttext,0,1)
  • if ((strcasecmp(st2,"RT") !0)
    (strcasecmp(st1,"_at_")!0)) //case insensitive
    compare to RT
  • ?gt

13
  • ltligt
  • ltimg src"lt?php echo d-gtprofile_image_url ?gt"
    alt"" /gt
  • lt?php echo preg_replace('/(\s)_at_(\w)/','\1lta
    href"http//twitter.com/\2"gt_at_\2lt/agt', d-gttext)
    ?gt
  • ltemgtbylt/emgt
  • lta href"http//twitter.com/lt?php echo
    d-gtfrom_user ?gt"gtlt?php echo d-gtfrom_user
    ?gtlt/agt
  • lt?php echo d-gtcreated_at ?gt ltemgtfromlt/emgt
  • lt?php echo html_entity_decode(d-gtsource) ?gt
  • lt/ligt
  • lt?php ?gt
  • lt/ulgt
  • lt/bodygtlt/htmlgt

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.
Write a Comment
User Comments (0)
About PowerShow.com