symbol = $data[0]; $stock->name = $data[1]; $stock->price = $data[2]; $stock->time = strtotime($data[3] . " " . $data[4]); $stock->change = $data[5]; $stock->open = $data[6]; $stock->high = $data[7]; $stock->low = $data[8]; // return stock return $stock; } /* * void * redirect($destination) * * Redirects user to destination, which can be * a URL or a relative path on the local host. * * Because this function outputs an HTTP header, it * must be called before caller outputs any HTML. */ function redirect($destination) { // handle URL if (preg_match("/^http:\/\//", $destination)) header("Location: " . $destination); // handle absolute path else if (preg_match("/^\//", $destination)) { $protocol = (@$_SERVER["HTTPS"]) ? "https" : "http"; $host = $_SERVER["HTTP_HOST"]; header("Location: $protocol://$host$destination"); } // handle relative path else { // adapted from http://www.php.net/header $protocol = (@$_SERVER["HTTPS"]) ? "https" : "http"; $host = $_SERVER["HTTP_HOST"]; $path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); header("Location: $protocol://$host$path/$destination"); } // exit immediately since we're redirecting anyway exit; } ?>