Created
February 11, 2013 20:05
-
-
Save kajigga/4757161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Read the php input and save it to a file. | |
$fname = sprintf('takegrades_output/output_%s.txt',uniqid()); | |
print $fname; | |
file_put_contents($fname,file_get_contents('php://input')); | |
/* | |
* Read the input sent via the script, parse it as CSV and save it in | |
* $grade_data_received which is an associative array | |
*/ | |
$grade_data_received = array(); | |
if (($handle = fopen($fname, "r")) !== FALSE) { | |
$header_keys = array(); | |
$header_keys = fgetcsv($handle,0,","); | |
while (($data = fgetcsv($handle, 0, ",")) !== FALSE) { | |
$grade_data_received[] = array_combine($header_keys,array_pad($data,count($header_keys),"-")); | |
} | |
} | |
print_r($grade_data_received); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment