/ Published in: PHP
Very minimal. Some homegrown API seeds from a while ago. Just posting for use as some php examples.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* Requires an .htaccess file that rewrites the request to q=, like, RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] Now tha I look at it, not sure why I just didn't explode $_REQUEST_URI. */ $debug = 1; $module = $q[0]; $op = $q[1]; $source = 'http://finance.yahoo.com/d/quotes.csv?s='; $nyse_source = 'http://www.csidata.com/factsheets/nyse.txt'; $nyse_index = 'nyse_index.txt'; $nyse_index_path = $files.$nyse_index; $files_dir = './files/'; $include_dir = './include/'; $module_path = $include_dir.$module.'.inc'; switch ($module) { case 'fields': include $module_path; //$csvdata = get data for $q[1]; break; case 'nyse': include $module_path; if ($op == 'refresh') { $new_index = nyse_fetch(); $ret = nyse_compare($new_index); print $ret; } elseif ($op == 'load') { $ret = nyse_load_db(); print $ret; } else { // for now just redirect // in the future print header and read text file //nyse_send_index(); } break; } //close switch echo 'hello'; ?>