Answer the question
In order to leave comments, you need to log in
How to send a curl request via php?
A .py script is launched on the server that receives a curl request, the request itself:
Tell me, how can I send this request using php? And how can I get and output a response from a .py script (json response) curl -F "[email protected]" http://127.0.0.1:5001
Answer the question
In order to leave comments, you need to log in
There is no such thing as a curl request. cURL is a utility for making http requests from the command line. PHP has an interface to the libcurl library :
$request = curl_init('http://127.0.0.1:5001/');
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => '@' . realpath('image.jpg')
)
);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
curl_close($request);
Documentation:
php.net/manual/ru/book.curl.php
Video tutorials:
https://www.youtube.com/watch?v=oVdwiuqeOt0&list=P...
https://www.youtube.com/watch ?v=qEpPbgwB8Q8
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question