Python Forum
Convert Python script to Php - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Convert Python script to Php (/thread-21931.html)



Convert Python script to Php - JuroClash - Oct-21-2019

Hello,
I would like to convert this python code to php

 payloadNotes = "data={\"token\": \"" + token + "\"}"
    headersNotes = {'content-type': 'application/x-www-form-urlencoded'}

    r = requests.post("https://vmws17.ecoledirecte.com/v3/eleves/" + str(eleve_id) + "/notes.awp?verbe=get&",
                      data=payloadNotes, headers=headersNotes, proxies=proxies, verify=False)
$token= $data["token"];
$postt= "data=token: $token";
$url2 = "https://vmws17.ecoledirecte.com/v3/eleves/$id/notes.awp?verbe=post&$postt";
$ch2 = curl_init($url2);


curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
$res2 = curl_exec($ch2);
$data2 = json_decode($res2, true);
curl_close($ch2);
echo "<pre>";
var_dump($data2);
echo "</pre>";
But there are no data.

Can you help me please ?