Projecting the Finale
I purchased Ektachrome 64T super 8 Colour film from Kodak. Calling 800-668-7678 connected me with their warehouse on Ile-des-Soeurs where I obtained it at a discounted student price. I must still perform the recording and have the super 8 film developed at L.L.Lozeau.
The PHP script responsible for scraping the 411.ca database is in place ready to retrieve the phone numbers for the project. I must connect the Arduino to the internet and to the electrical socket to finalize the automated projectionist module. It will be necessary to arrange an internet access drop with IITS for the class presentation December 2nd 2009.
<?php
//By Emmanuel Lalande
//For CART 453
//OCT 18 2009
include('db_connection.php');
//get variables from address bar
$areaCode = $_GET['area'];
$city= $_GET['city'];
$depth= $_GET['depth'];
$fLetter = $_GET['fletter'];
$lLetter = $_GET['lletter'];
//declaratoin of variables:
$rightDelimiter = '(';
$leftDelimiter = ') ';
//how deep will this search go?
$maxPages = $depth;
//array to store phone numbers
$phoneNumbers = array();
//this will store the web address and its variables
$myFile = '';
//loop this for as many letters as there are in the alphabet
while($fLetter <= $lLetter){
//read pages as deep as we requested
for ($currPage = 0; $currPage <= $maxPages; $currPage++){
//scan 411.ca
$myFile = 'http://www.411.ca/whitepages/?fn=First%20Name&ln=' . $fLetter . '&cz=' . $city . '&page='. $currPage;
// make sure the file is successfully opened before doing anything else
if ($fp = fopen($myFile, 'r')) {
$content = file_get_contents ($myFile);
//there are 10 phone numbers per 411.ca page
for($i=1; $i<=10; $i++){
// find the first occurence of the phone number and truncate the file
$searchString = $rightDelimiter.$areaCode.$leftDelimiter;
$content = strstr ( $content , $searchString );
// convert the phone number to a numerical value and remove the '-' delimiters
$rawNumber = substr($content,6,9);
$rawNumber = $areaCode.substr($rawNumber,0,3).substr($rawNumber,4,4);
// send it to the array
$phoneNumbers[] = $rawNumber;
$content = substr($content,7);
}
} else {
// an error occured when trying to open the specified file
}
}
//move on to the next letter in the alphabet
$fLetter++;
}
//send the obtained values of this harvest to the Database
foreach ($phoneNumbers as $phoneNumber){
$query =
'INSERT INTO qwenippi_phone.number (id , number)
VALUES (
NULL , "'.$phoneNumber.'")';
mysql_query($query);
}
//success!
echo "Harvested ". count($phoneNumbers) . " phone numbers.";
?>
[/code]
Printed Resources [clues links]
Igoe, Tom. 2007. Making things talk. Make: Projects. 1st ed. Beijing: O'Reilly.
Van Meggelen, Jim, Leif Madsen, and Jared Smith. 2007. Asterisk :The future of telephony. 2nd ed. Sebastopol, CA: O'Reilly.
Wallingford, Ted. 2006. VoIP hacks. 1st ed. Beijing; Sebastopol, CA: O'Reilly.



























One Response
[...] Projecting the Finale [...]