I'm cleaning up my previous post a bit to hopefully provide some more useful information.
So I have a piece of code that pulls from a secured website using POST. I have spoken to the person who runs that host site and he said their CA cert does not cover subdomains. So, the reason my site cannot resolve the cert is because it is looking for bbs.hitechcreations.com while the cert only covers hitechcreations.com, according to him.
Therefore, I am forced to disable the verification of SSL (which is not a problem, there is no sensitive data being passed). However, no matter what I try, I can't seem to get it to disable.
PHP Error reporting kicks back the following:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /home4/ahevent2/public_html/components/com_jumi/views/application/view.html.php(85) : eval()'d code on line 39
Warning: file_get_contents(): Failed to enable crypto in /home4/ahevent2/public_html/components/com_jumi/views/application/view.html.php(85) : eval()'d code on line 39
Warning: file_get_contents(https://bbs.hitechcreations.com/cms/cmlogs.php): failed to open stream: operation failed in /home4/ahevent2/public_html/components/com_jumi/views/application/view.html.php(85) : eval()'d code on line 39
bool(false)
Below is my current section of code
<?php
require_once("/home4/ahevent2/public_html/jumi_src/event_logs/admin_functions.php");
if (isset($_POST["username"]) && !empty($_POST["password"]) && !isset($_POST["event_type"]))
{
$username = $_POST["username"];
$password = $_POST["password"];
$url = "https://bbs.hitechcreations.com/cms/cmlogs.php";
$f1 = 'loginid'; // Name of field1(ON THE WEBSITE YOU'RE TRYING TO LOGIN ON!)
$f2 = 'password'; // Name of field2(ON THE WEBSITE YOU'RE TRYING TO LOGIN ON!)
$v1 = $username; // Value of field1(FROM THE WEBSITE YOU'RE TRYING TO LOGIN FROM!)
$v2 = $password; // Value of field2(FROM THE WEBSITE YOU'RE TRYING TO LOGIN FROM!)
//$find = 'Welcome to your account'; // String to search for in the page you've logged in on
$postchars = http_build_query( array($f1 => $v1, $f2 => $v2) );
$stream = stream_context_create( array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => htmlspecialchars_decode( $postchars ) ) ) ); // Creates an array of the sourcecode, and inputs the values of the field1 and field2
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$fh = file_get_contents($url, false, $stream); //for troubleshooting.
var_dump($fh);
//REALLY NEEDS A HANDLER FOR WHEN $FH DOESN"T COME BACK FOR SOME REASON.
//printf("Login wasn't completed. No file was retreived. Please check your password at the htc CM login page to verify that it's good. If it is there is a systme issue. Please let Nefarious know.");
//FOR TROUBLESHOOTING
// printf("<textarea rows='100' cols='100'>");
// printf($fh);
// printf("</textarea>");
//getting the dropdown box returned from THC to select a scenario to upload
$a = strpos($fh, "<select name");
$b = strpos($fh, "</SELECT>");
$c = strlen($fh) - $b;
$e = substr($fh, $a, -$c);
I also have the following at the bottom of my php.ini file:
extension=php_openssl.dll
allow_url_fopen = On
CURLOPT_SSL_VERIFYPEER=FALSE
Is there anything else I need to do or change in order to turn off cert verification? Nothing I've done has seemed to work thus far.