I can open a page by PHP like this:
$html = file_get_contents('https://hammihan.com/search.php');
But it will be redirected to https://hammihan.com/users.php. Because name input is empty. Now I need to open that URL and pass a POST parameter to it. Something like this:
$_POST['name'] = 'myname';
Anyway, how can I do that by PHP ?
EDIT:
I've tested CURL approach but it returns nothing. Here is my code:
public function hammihan($request)
{
    $val = 'ali'; // urlencode($request->name);
    $url = "https://hammihan.com/search.php";
    $data['name'] = $val;
    $data['family'] = "";
    $data['marriage'] = 1;
    $handle = curl_init($url);
    curl_setopt($handle, CURLOPT_POST, true);
    curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
    curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($handle, CURLOPT_URL, $url);
    $res = curl_exec($handle);
    return $res;
}
The output of function above is empty. Noted that when I paste following code into a .html page, it works:
<form class="loginform" action="https://hammihan.com/search.php" method="POST">
    <input type="hidden" name="searcher" value="searcher">
    <input name="name" value="" type="text" placeholder="???">
    <input name="family" value="" type="text" placeholder="??? ????????">
    <select name="marriage">
        <option>?????</option>
        <option value="1">???</option>
        <option value="2">??</option>
    </select>
    <input type="submit" value="?????">
    <div class="marginbottom"></div>
</form>
What's wrong? Why I cannot get the result by PHP?
 
     
     
    