Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Fipy, Lopy, Wipy Http Post?

    Scheduled Pinned Locked Moved FiPy
    lopy fipy wipy
    6 Posts 3 Posters 683 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      Wolli01
      last edited by

      How do I transfer data so that I can retrieve it on a web server like this?
      <?php
      //Sensor1
      $p1 = $_GET["p1"];
      $p2 = $_GET["p2"];
      $p3 = $_GET["p3"];
      $p4 = $_GET["p4"];
      $p5 = $_GET["p5"];

      $p6 = $_GET["p6"];
      $p7 = $_GET["p7"];
      $p8 = $_GET["p8"];
      $p9 = $_GET["p9"];
      $p10 = $_GET["p10"];

      $p11 = $_GET["p11"];
      $p12 = $_GET["p12"];
      $p13 = $_GET["p13"];
      $p14 = $_GET["p14"];
      $p15 = $_GET["p15"];

      $p16 = $_GET["p16"];
      $p17 = $_GET["p17"];
      $p18 = $_GET["p18"];
      $p19 = $_GET["p19"];
      $p20 = $_GET["p20"];

      $inhalt = array($p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9, $p10, $p11, $p12, $p13, $p14, $p15, $p16, $p17, $p18, $p19, $p20);
      // Speichern der Datei
      $eintrag = implode(";", $inhalt);
      file_put_contents("sensor1.txt", $eintrag);
      ?>

      Translated with www.DeepL.com/Translator

      1 Reply Last reply Reply Quote 0
      • W Offline
        Wolli01
        last edited by

        Please help me!

        1 Reply Last reply Reply Quote 0
        • M Offline
          Martinnn
          last edited by

          Not sure what you are trying to do...
          As you write "POST" in your title - are you aware of the urequrests library (which provides http/https put, get, post...)?

          W F 2 Replies Last reply Reply Quote 0
          • W Offline
            Wolli01 @Martinnn
            last edited by

            @martinnn said in Fipy, Lopy, Wipy Http Post?:

            Not sure what you are trying to do...
            As you write "POST" in your title - are you aware of the urequrests library (which provides http/https put, get, post...)?

            Yes, I know the library, but I don't know how to use it to send it to my webserver via post command and then get it via PHP.
            I'm new to Python.

            1 Reply Last reply Reply Quote 0
            • W Offline
              Wolli01
              last edited by

              Das funktioniert leider nicht.

              import requests
              userdata = {"firstname": "John", "lastname": "Doe", "password": "jdoe123"}
              resp = requests.post('http://yourserver.de/test.php', params=userdata)
              Your PHP-File:

              $firstname = htmlspecialchars($_GET["firstname"]);
              $lastname = htmlspecialchars($_GET["lastname"]);
              $password = htmlspecialchars($_GET["password"]);
              echo "firstname: $firstname lastname: $lastname password: $password";
              firstname: John lastname: Doe password: jdoe123

              1 Reply Last reply Reply Quote 0
              • F Offline
                Franz @Martinnn
                last edited by

                @Martinnn i have been trying to use urequests for HTTP POST and i always receive the error msg that the function accepts only 2 positional args while it gets 4 (or something along that line). have seen may msg in various fora about that error, but never found a turn-around that worked for me.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom