3

i need to send this file path /Users/bob/Documents/python_stuff/venv/json_output.json to the php page of http://localhost:8888/demo/display_data.php

My python code:

url = 'http://localhost:8888/demo/display_data.php'
file_path_json = {"1": "/Users/bob/Documents/python_stuff/venv/json_output.json"}
resp = requests.post(url, params=file_path_json)

php code:

$json_path['1'] = $_GET['1']; 

I do not know why it is not working. I have installed the requests module.

bob
  • 537
  • 1
  • 5
  • 12

1 Answers1

2

I have tried following code on my PC and it's working for me

import requests

url = 'http://localhost/dx/index.php'
file_path_json = {"1": "/Users/bob/Documents/python_stuff/venv/json_output.json"}
resp = requests.post(url, file_path_json)
print(resp)

hope this helps

Rajinder
  • 1,131
  • 1
  • 14
  • 29