I have a background script running via socket as follows
if (strstr($_SERVER['PHP_SELF'], "/")) {
$location = array();
$location = explode("/", $_SERVER['PHP_SELF']);
$folder = $location[count($location) - 2];
}
else {
$folder = $_SERVER['PHP_SELF'];
}
//script, runs in background
$host = HOST;
$remote_house = 'https://'.$host.'/'.$folder.'/controllers/background';
$socketcon = fsockopen($host, 80);
if($socketcon) {
$socketdata = "GET $remote_house/".$scriptName." HTTPS 1.1\r\nHost: $host\r\nConnection: Close\r\n\r\n";
fwrite($socketcon, $socketdata);
fclose($socketcon);
}
This is working properly on localhost and online with HTTP but it fails to work on HTTPS with this error.
HTTP/1.0 400 Bad request Cache-Control: no-cache Connection: close Content-Type: text/html 400 Bad request Your browser sent an invalid request.
Any idea?