Hi there! I have a cgi script that is supposed to send data collected via a iOS app to a server and output as a csv file. I have input the cgi script in my server, linked it in my code for my app for data collection. However when I go to "collect" the data via servername/script.cgi/nameoffile.csv it does nothing. I can't tell if it's an issue on the server side or my code. Any insight?
#!/usr/bin/perl -ws + use CGI; my $query = CGI->new; my $id = $query->param( 'participant_id' ); print $query->header; print "You are participant $id!"; # Create outfile for saving data! my $filename = "participant_".$id."_data.csv"; open( OUTFILE, ">>$filename") or die $!, "Couldn\'t open outfile for r +eading!\n"; my @keys = $query->param(); print OUTFILE 'pause_time'."\t".$query->param('pause_time')."\n"; foreach my $key (@keys) { if (($key ne 'participant_id') && ($key ne 'pause_time')) { print OUTFILE $key."\t"; print OUTFILE $query->param($key); print OUTFILE "\n"; } } close( OUTFILE ); 1;
In reply to CGI script to output data as CSV by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |