#!/bin/bashCURL=curl#OUTPUT=output.kmzPILOT=$USERDATE=`date +%d/%m/%y`TIMESHIFT=`date +%z`#TAKEOFF=undef#LANDING=undef#INPUT=input.igcANALYSIS=1CFD=1# no customization belowURL=http://trace.parawing.net/gps2ge.phpEXTRA=if [ ! -z $ANALYSIS ]; then EXTRA+=" -F Analysis=checked "fiif [ ! -z $CFD ]; then EXTRA+=" -F cfd=checked "fi$CURL -o $OUTPUT \ -F MAX_FILE_SIZE=1000000 \ -F pilot=$PILOT \ -F date=$DATE \ -F timeshift=$TIMESHIFT \ -F departure="$TAKEOFF" \ -F arrival="$LANDING" \ -F userfile=(@)$INPUT \ $EXTRA \ -F ' '=checked \ $URL
$ INPUT=plomb-st-hil.igc OUTPUT=plom-st-hil.kmz TAKEOFF="Saint Hil Nord" LANDING="Lumbin" ~/bzr/misc-tools/gps2ge-cli/gps2ge.sh
<?php$postfields = array();$postfields["MAX_FILE_SIZE"] = "1000000";$postfields["pilot"] = "Pilot Name";$postfields["date"] = "12/10/2010";$postfields["timeshift"] = "+3";$postfields["departure"] = "takeoff name";$postfields["arrival"] = "arrival name";$postfields["userfile"] = "http://www.paraglidingearth.com/pgSimCompEvent/igc/event3/task3/raf.igc";$postfields["Charts"] = "on";$postfields["cfd"] = "off";$postfields["Analysis"] = "off";$postfields["choix"] = "on";//url de la page de soumission$url = "http://trace.parawing.net/get_form_gps2ge.php";$useragent = "Mozilla/5.0";$referer = $url; //Initialise une session CURL$ch = curl_init($url);//CURL optionscurl_setopt($ch, CURLOPT_POST, 1);//On poste les données du tableau $postfieldscurl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);//On définit un useragent ici Mozilla/5.0curl_setopt($ch, CURLOPT_USERAGENT, $useragent);//On passe un referrer ici on passe la même page $urlcurl_setopt($ch, CURLOPT_REFERER, $referer);//on récupère le contenu de la page de résultat de la soumission dans une chainecurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// en cas de redirection (facultatif ici)//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);//Page de résultats et fermeture de session$result = curl_exec($ch);curl_close($ch); //on peut faire un echo du résultat obtenuecho $result;?>
<?php$postfields = array();$postfields["MAX_FILE_SIZE"] = "1000000";$postfields["pilot"] = "Pilot Name";$postfields["date"] = "24/05/2010";$postfields["timeshift"] = "+3";$postfields["departure"] = "takeoff name";$postfields["arrival"] = "arrival name";$postfields["userfile"] = "http://www.paraglidingearth.com/pgSimCompEvent/igc/event3/task3/raf.igc";$postfields["Charts"] = "on";$postfields["cfd"] = "off";$postfields["Analysis"] = "off";$postfields["choix"] = "on";//url de la page de soumission//ici mon annuaire (qui a un captcha donc inutile de tenter la soumission auto, c'est pour l'exemple)$url = "http://trace.parawing.net/get_form_gps2ge.php";$useragent = "Mozilla/5.0";$referer = $url; //Initialise une session CURL$ch = curl_init($url);//CURL optionscurl_setopt($ch, CURLOPT_POST, 1);//On poste les données du tableau $postfieldscurl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);//On définit un useragent ici Mozilla/5.0curl_setopt($ch, CURLOPT_USERAGENT, $useragent);//On passe un referrer ici on passe la même page $urlcurl_setopt($ch, CURLOPT_REFERER, $referer);//on récupère le contenu de la page de résultat de la soumission dans une chaine//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// en cas de redirection (facultatif ici)if (curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1)) echo "good";//Page de résultats et fermeture de session$result = curl_exec($ch);curl_close($ch); //on peut faire un echo du résultat obtenu//echo $result;?>
<form method="post" action="http://trace.parawing.net/get_form_gps2ge.php" enctype="multipart/form-data"><input type="hidden" value="1000000" name="MAX_FILE_SIZE"><input type="hidden" maxlength="30" size="30" value="Anonymous" name="pilot"><input type="hidden" maxlength="10" size="10" value="25/05/2010" name="date"><input type="hidden" maxlength="3" size="3" value="+3" name="timeshift"><input type="hidden" maxlength="30" size="30" value="takeoff name" name="departure">...<input type="submit" value="sors-zy moi le KMZ" name="choix"></form>