Salve,
Sto lavorando su un tool online di similarità genetica, ed ho necessità di automatizzare il procedimento di recupero del risultato. Il form di input online è composto da diversi combobox, una textarea(UserData) e un bottone di tipo file.
Ho recuperato tramite plugin firefox, i dati inviati via post dal form, e sono i seguenti:
codice:
POSTDATA =-----------------------------114782935826962
Content-Disposition: form-data; name="SMeasure"
3
-----------------------------114782935826962
Content-Disposition: form-data; name="SOntology"
2
-----------------------------114782935826962
Content-Disposition: form-data; name="SFamily"
2
-----------------------------114782935826962
Content-Disposition: form-data; name="IncludeIEA"
1
-----------------------------114782935826962
Content-Disposition: form-data; name="SApproach"
2
-----------------------------114782935826962
Content-Disposition: form-data; name="Identifier"
1
-----------------------------114782935826962
Content-Disposition: form-data; name="UserData"
-----------------------------114782935826962
Content-Disposition: form-data; name="InputFile"; filename="CHI2-GR.txt"
Content-Type: text/plain
Q15942 Q15942
Q15942 P27918
Q15942 P01034
Q15942 P01040
Q15942 P04053
Q15942 P00746
Q15942 P20138
Q15942 P10620
Q15942 P15923
Q15942 Q06481
P27918 Q15942
P27918 P27918
P27918 P01034
P27918 P01040
P27918 P04053
P27918 P00746
P27918 P20138
P27918 P10620
P27918 P15923
P27918 Q06481
P01034 Q15942
P01034 P27918
P01034 P01034
P01034 P01040
P01034 P04053
P01034 P00746
P01034 P20138
P01034 P10620
P01034 P15923
P01034 Q06481
P01040 Q15942
P01040 P27918
P01040 P01034
P01040 P01040
P01040 P04053
P01040 P00746
P01040 P20138
P01040 P10620
P01040 P15923
P01040 Q06481
P04053 Q15942
P04053 P27918
P04053 P01034
P04053 P01040
P04053 P04053
P04053 P00746
P04053 P20138
P04053 P10620
P04053 P15923
P04053 Q06481
P00746 Q15942
P00746 P27918
P00746 P01034
P00746 P01040
P00746 P04053
P00746 P00746
P00746 P20138
P00746 P10620
P00746 P15923
P00746 Q06481
P20138 Q15942
P20138 P27918
P20138 P01034
P20138 P01040
P20138 P04053
P20138 P00746
P20138 P20138
P20138 P10620
P20138 P15923
P20138 Q06481
P10620 Q15942
P10620 P27918
P10620 P01034
P10620 P01040
P10620 P04053
P10620 P00746
P10620 P20138
P10620 P10620
P10620 P15923
P10620 Q06481
P15923 Q15942
P15923 P27918
P15923 P01034
P15923 P01040
P15923 P04053
P15923 P00746
P15923 P20138
P15923 P10620
P15923 P15923
P15923 Q06481
Q06481 Q15942
Q06481 P27918
Q06481 P01034
Q06481 P01040
Q06481 P04053
Q06481 P00746
Q06481 P20138
Q06481 P10620
Q06481 P15923
Q06481 Q06481
-----------------------------114782935826962
Content-Disposition: form-data; name="Submit"
Submit
-----------------------------114782935826962--
Il mio codice php, invece, è semplicemente questo:
codice:
$url = 'http://web.cbio.uct.ac.za/ITGOM/tools/itgomEngine.php';
$postData = array();
$postData['SMeasure'] = '3';
$postData['SOntology'] = '2';
$postData['SFamily'] = '2';
$postData['IncludeIEA'] = '1';
$postData['SApproach'] = '2';
$postData['Identifier'] = '1';
$postData['UserData'] = "";
$postData['InputFile'] = "@C:\Users\Matteo\Desktop\test.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$response = curl_exec($ch);
echo $response;
Il problema è che riesco a settare tutte le diverse opzioni, ad eccezione del file in input ottenendo l'errore "For the gene list file, only txt format are recommended!". Se invece provo così:
codice:
$postData['InputFile'] = "@C:\Users\Matteo\Desktop/test.txt;type=text/plain";
ottengo l'errore "Running fails! Gene list, i.e., a list of interesting genes is missing!".
Qualche idea in merito? Grazie!