Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (44 sloc) 1.624 kb
ae2906b Jonathan LeBlanc init - sample code
authored
1 <?php
2 /*************************************************************************************************************
3 * update_small_from_cron.php
4 * Update Small YAP View From Cron Job Sample
5 *
6 * Created by Jonathan LeBlanc on 06/08/09.
7 * Copyright (c) 2009 Yahoo! Inc. All rights reserved.
8 *
9 * The copyrights embodied in the content of this file are licensed under the BSD (revised) open source license.
10 *************************************************************************************************************/
11
12 require_once('apis/Yahoo.inc');
13
14 //session information
15 define('API_KEY', 'KEY HERE');
16 define('SHARED_SECRET', 'KEY HERE');
17 define('APP_ID', 'APP ID HERE');
18
19 //instantiate session
20 $session = new YahooApplication(API_KEY, SHARED_SECRET, APP_ID);
21
22 //db information
23 $dbhostname = '###';
24 $dbusername = '###';
25 $dbpassword = '###';
26 $dbname = '###';
27
28 //connect to database and get all users
29 mysql_connect($dbhostname, $dbusername, $dbpassword) OR DIE ('Unable to connect to database. Please try again later.');
30 mysql_select_db($dbname);
31 $query = "SELECT * FROM user_store";
32 $result = mysql_query($query);
33 $j = 1;
34
35 //for each database user, update the small view
36 while (($row = mysql_fetch_assoc($result)) !== false) {
37 if ($row['uid']){
38 $html = '';
39
40 ##################################
41 #CREATE HTML CODE FOR CURRENT USER
42 ##################################
43
44 if (!$session->setSmallView($row['uid'], $html)){
45 echo "$j : NO SESSION SET FOR {$row['uid']}<br />\n";
46 } else {
47 echo "$j : SESSION SET FOR {$row['uid']}<br />\n";
48 }
49 $j++;
50 }
51 }
52 ?>
Something went wrong with that request. Please try again.