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.

0

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

you just need to remove "params" just pass url and file_path_json into post request

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.