<?php
function do_post($url, $data)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
if(isset($_POST['submit'])) {
$information = array('username' => $_POST['username'], 'password' => $_POST['password']);
$json = json_encode($information);
$url = 'http://domain.com/receive.php';
$data = array(
'content' => $json
);
$res = do_post($url, $data);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<form metod="post" action=">
username:<input type="text" name="username"/>
password:<input type="password" name="password"/>
<input type="submit" name="submit" value="send"/>
</form>
</body>
</html>