Jump to content

erfan shaigani

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by erfan shaigani

  1. hi , im using python to make a get request to a my server and I want to get the 'params' 

    import requests
    
    url = 'https://w3schools.com/python/demopage.php'
    
    #demonstrate how to use the 'params' parameter:
    x = requests.get(url, params = {"model": "Mustang"})
    
    #print the response (the content of the requested file):
    print(x.text)
    
    #the file 'demopage.php' looks for a 'model' query string and prints its value.

    #the file demo.php looks for a 'model' ...

    how can I do that?

  2. Hi , I am not familiar with javascript at all , I am going to learn node.js 

    (I have a good background in python , c )

    now , I don't know where to start, should I master js then go for nodejs , or a basic learning of js is adequate for nodejs or...

    I will appreciate if you suggest useful sources and websites to learn .

    Thanks in advance 

  3. 9 hours ago, Ingolme said:

    I'm not sure how Python is sending the data, but your PHP code will depend on the format of the data.

    Assuming that Python is sending a JSON string, you can read the string using file_get_contents('php://input') and transform it into an array or object using json_decode().

    
    <?php
    $input = file_get_contents('php://input');
    $data = json_decode($input, true);
    
    // Print out the structure for testing
    var_dump($data);
    
    ?>

     

    thanks a lot it worked for me , but i have another question , what if i want to send a file i mean really a file.json to a directory on my server?

  4. hi , in the python requests POST tutorial in the site , there is this piece of code ,

    url = 'https://ipaddress of my server .../myphp.php'
    myjson = {'somekey': 'somevalue'}

    x = requests.post(url, json = myjson)
     

    it sends the json data to a php file in a server that i have access to

    how can I access json data in myphp.php file in the server ???

    thanks

     

     

×
×
  • Create New...