'Failed to open stream: HTTP request failed! HTTP/1.1 406 Not Acceptable

I am making an http post request to a simple php server on the same domain, it was working till yesterday , but all of a sudden it started giving me this error : file_get_contents(https://example.com/wp-content/pt/new.php): Failed to open stream: HTTP request failed! HTTP/1.1 406 Not Acceptable in /home2/userad/public_html/wp-content/pt/serv.php on line 295

(serv.php) =>This is the Code thats making the POST request :

                                    $url = 'https://example.com/wp-content/pt/new.php';
                                $dataa = array(
                                    'Account' => $act,
                                    'usrname' => $uno,
                                    'name' => $fullname,
                                    'Status' => $status,
                                    'Package' => $pkg,
                                    '1' => 'gt-1' ,                                   
                                    '2' => 'gt-3-4' ,                                   
                                    '3' => 'gt-fg' ,                                   
                                    '4' => 'gt-VE' ,                                   
                                    '5' => 'gt-gf' ,                                   
                                    '6' => 'gt-lg' ,                                   
                                    '7' => 'gt-ht' ,                                   
                                    '8' => 'gt-xt' ,                                   
                                    '9' => 'gt-TC' ,                                   
                                    '10' => 'gt-ft' ,                                   
                                    '11' => 'gt-za',
                                    '12' => 'gt-hk',
                                    '13' => 'gt-hp');
                                $options = array(
                                    'http' => array(
                                        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                                        'method'  => 'POST',
                                        'content' => http_build_query($dataa)
                                    )
                                );
                                $context  = stream_context_create($options);
                                $result = file_get_contents($url, false, $context); //This is the line 295 that the error log points to 
                               echo($result);

Any suggestions as to what could be the cause of this issue ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source