Sun Jan 7 16:40:48 UTC 2024

This commit is contained in:
Odweta
2024-01-07 16:40:48 +00:00
parent 8181fa15af
commit 5c7ec71442
9 changed files with 105 additions and 7 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
//The url you wish to send the POST request to
$url = "http://localhost:8080/fetch.php";
//The data you want to send via POST
$fields = [
'username' => "x",
'password' => "y"
];
//url-ify the data for the POST
$fields_string = http_build_query($fields);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
echo $result;
?>