<commit_before><?php

namespace App\Services;

class LocationService
{
    /**
     * @param string $address
     * @return array
     * @throws \HttpRequestException
     */
    public static function getLocation($address)
    {
        if (!env('GOOGLE_API_SERVER_KEY')) {
            throw new \HttpRequestException('Google API Key Not Found!! Make sure that you have set KEY in your .env file.');
        }
        // set url
        $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=' . env('GOOGLE_API_BROWSER_KEY');

        // get the json response
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_URL, $url);
        $resp_json = curl_exec($ch);
//        $resp_json = file_get_contents($url);

        // decode the json
        $resp = json_decode($resp_json, true);

        dd($resp);

        // check response
        if ($resp['status'] == 'OK') {
            $lati = $resp['results'][0]['geometry']['location']['lat'];
            $longi = $resp['results'][0]['geometry']['location']['lng'];
            // check data
            if ($lati && $longi) {
                $location = [$longi, $lati];

                return $location;
            }
        }
        return [];
    }
}<commit_msg>Fixed #4. Ignore SSL verify in curl.<commit_after><?php

namespace App\Services;

class LocationService
{
    /**
     * @param string $address
     * @return array
     * @throws \HttpRequestException
     */
    public static function getLocation($address)
    {
        if (!env('GOOGLE_API_SERVER_KEY')) {
            throw new \HttpRequestException('Google API Key Not Found!! Make sure that you have set KEY in your .env file.');
        }
        // set url
        $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=' . env('GOOGLE_API_BROWSER_KEY');

        // get the json response
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_URL, $url);
        $resp_json = curl_exec($ch);

        // decode the json
        $resp = json_decode($resp_json, true);

        // check response
        if ($resp['status'] == 'OK') {
            $lati = $resp['results'][0]['geometry']['location']['lat'];
            $longi = $resp['results'][0]['geometry']['location']['lng'];
            // check data
            if ($lati && $longi) {
                $location = [$longi, $lati];

                return $location;
            }
        }
        return [];
    }
}
{'fraction_non_alphanumeric': 0.15393343419062028, 'fraction_numerical': 0.0018910741301059002, 'mean_word_length': 2.0720092915214865, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6623632', 'n_tokens_mistral': 803, 'n_tokens_neox': 777, 'n_words': 178}