I have looked at the other similar questions to this here on stack overflow, including the method seen [here][1] trying out various methods but I am still encountering the same issue.
here is my php code.
function LogIn($username, $password){
$url = 'https://www.example.com';
$data = array('username' => $username, 'password' => $password);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if (strpos($result, "incorrect") !== false){
return false;
} else {
if (strpos($res, "Log In") !== false) {
echo "captcha solve needed - ";
return false;
} else {
return true;
}
}
var_dump($result);
}
I am receiving the following in my php error logs.
[04-Jun-2017 22:24:13 Europe/London] PHP Warning: file_get_contents(): SSL: Connection reset by peer in /Users/xx/Desktop/xxx/index.php on line 47
[04-Jun-2017 22:24:13 Europe/London] PHP Warning: file_get_contents(): Failed to enable crypto in /Users/xxx/Desktop/xxxx/index.php on line 47
[04-Jun-2017 22:24:13 Europe/London] PHP Warning: file_get_contents(https://www.example.com): failed to open stream: operation failed in /Users/xxx/Desktop/xxxx/index.php on line 47
Could anyone please suggest a method I could fix this.
SOLUTION Fixed this by simply upgrading my mamp.