First need to create html file
Doctype HTML file
<!DOCTYPE html> <html lang="en"> <head> <title>Get code</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> </head> <body> </body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Get code</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</head>
<style>
body{
background-color: #f3ecec;
}
</style>
<body>
<div class="container">
<div class="text-center mt-5">
<h2>php Curl How to get code example</h2>
</div>
<br>
<div class="col-md-12">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="card bg-light p-5">
<h3>Example Loreum Ipsum</h3>
<p>Duis ut libero vel felis pellentesque tincidunt et eu sapien.
Pellentesque convallis nisl a pulvinar lobortis. Etiam sit
amet neque pulvinar, vulputate erat eget, fermentum ante.
Integer sit amet diam vel arcu facilisis tincidunt eu in tellus...
</p>
</div>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</body>
</html>
<?php
$post = [
'name' => 'user',
'password' => 'passuser',
'gender' => 1,
];
$ch = curl_init('http://localhost/curl_data/example.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
?>