file_get_contents(): SSL operation fails 1 with phpmyadmin

163
March 21, 2018, at 11:27 AM

I just run into a problem, in my html file I give my customer the option to choose his location either from map or my typing his address and my goal is to get his longitude and latitude in both occasions. Up until now when I tried both versions worked but now the typing version doesn't work all of a sudden. It produces those 3 main errors: This is the code of the php file that handles the data received by the javascript table of html file.

  <?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7"/>
</head>
<?php
$servername = "localhost";
$user = "root";
$pass = "";
$dbname = "chaindatabase";
$number = stripslashes($_POST['street_number']);
$street = stripslashes($_POST['route']);        
$city = stripslashes($_POST['locality']);
$state = stripslashes($_POST['administrative_area_level_1']);
$zipcode = stripslashes($_POST['postal_code']);     
$country = stripslashes($_POST['country']);
$dlocation = $number . "\x20" . $street . "," . "\x20" . $city . "," . 
"\x20" . $state . "," . "\x20" . $country . "," . "\x20" . $zipcode;
echo $number . "\x20" . $street . "," . "\x20" . $city . "," . "\x20" . 
$country . "," . "\x20" . $zipcode . "<br>";
echo $dlocation . "<br>";
//$address = 'BTM 2nd Stage, Bengaluru, Karnataka 560076'; // Address format
$address = $dlocation;
// Get JSON results from this request
$geo = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json? 
address='.urlencode($address).'&key=AIzaSyBjrdIrxbhwjHuB5odogX0WO- 
G5YKWBv6o');
$geo = json_decode($geo, true); // Convert the JSON to an array
if (isset($geo['status']) && ($geo['status'] == 'OK')) {
  $latitude = $geo['results'][0]['geometry']['location']['lat']; // Latitude
  $longitude = $geo['results'][0]['geometry']['location']['lng']; // 
Longitude
  echo "<br>" . $latitude;
  echo "<br>" . $longitude;
}

$conn = new mysqli($servername, $user, $pass, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
//get session name and find customer's id 
$id_user = $_SESSION['session_username'];
.....

My key is valid because I use it on the version with selection of customer's location on map. I would really appreciate any help, ask my for any explanations.

Rent Charter Buses Company
READ ALSO
PHP usort Multi-dimensional array

PHP usort Multi-dimensional array

I'm having trouble getting usort to work and not sure what I'm missingBelow is an example of my array

218
Telegram PHP Bot - Answer to callback query

Telegram PHP Bot - Answer to callback query

Goodmorning everyoneAs you can see from the attached code, I created a Telegram bot via PHP and I added an inline keyboard

1838
Extending Query Statement to Include Users Following

Extending Query Statement to Include Users Following

I have a query that I am getting post from a databaseI have a 3 table join to get posts, profile picture, and user names

160
PHP how to do elseif final else statement to cover all other posibilities

PHP how to do elseif final else statement to cover all other posibilities

I have a georedirect code for cloudflare which goes as follows

149