Python Forum

Full Version: Convert Python script to Php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?