<?php
if( isset ($_POST['submit'] )){
$name = mysql_real_escape_string($_POST['name']);
$age = mysql_real_escape_string($_POST['age']);
$form_data = array(
'name'=> $name,
'age' => $age
);
$str = http_build_query($form_data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "[URL]http://localhost:8095/curl/data.php[/URL]");
curl_setopt($curl, CURLOPT_POST,1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $str);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
//print_r($data);
}
?>
<html>
<head>
<meta charset = "UTF-8" />
<title>cURL</title>
</head>
<body>
<div>
<?php
if( isset($output)){
echo $output;
}
?>
</div>
<form method = "post" action>
<p><strong>Your name</strong><br /><input type="text" name="name"></p>
<p><strong>Your age</strong><br /><input type="text" name="age"></p>
<p><input type="submit" value="send" name="submit"></p>
</form>
</body>
</html>