Adding new rows in table not displaying related information from database

I have a table where you can add and remove rows. I have a select option where you select a customer and then it populates a dropdown in the table with all the products. Once you have selected a product, it populates all the fields correlating that product, such as: price, description, tax etc.

My issue is that when i add a new row to the table, the products display in the new dropdown, however when i select a product it does not display the information for that product in the new row fields.

Table

<table class="table table-bordered">
   <thead>
     <tr>
     <th></th>
     <th><h6>Item</h6></th>
     <th><h6>Description</h6></th>
     <th><h6>Rate</h6></span></th>
     <th><h6>Quantity</h6></th>
     <th><h6>Tax</h6></th>
     <th><h6>Subtotal</h6></th>
     </tr>
   </thead>

   <tbody id="orders">
     <tr>
     <td><button type="button" name="add" id="add" class="btn btn-success circle">Add row</button></td>
     <!------ Item -------->
     <td><select style="width: 100%;" name="item" id="item1" class="browser-default custom-select-new"> 
         <option value="" disabled selected>Click to See Products</option>

                          <?php
                          $records = mysqli_query($conn, "SELECT * FROM customer_product WHERE customer LIKE '$Comid' ");
                          while ($data = mysqli_fetch_array($records)) {
                          $price = $data['new_total_rate'];
                            $product = $data['product'];
                            $discription = $data['description'];

                             echo '<option value="' . $data['product'] . '"  
                                 data-new_price_rate="' . $data['new_total_rate'] . '" 
                                 data-description="' . $data['description'] . '" 
                                 data-tax="' . $data['tax'] . '" >'
                                . $data['product'] . '</option>';     
                          }
                          ?>
         </select>
         </td>
         <!------ Description -------->
         <td><input class="form-control description" type='text' id='description1' name='description[]' for="1"/></td>

         <!------ Rate -------->
         <td><input class="form-control product_price" type='number' data-type="product_price" id='product_price1' name='product_price[]' for="1"/></td>

         <!------ Quantity -------->
         <td><input class="form-control quantity" type='number' id='quantity_1' name='quantity[]' for="1"/></td>

         <!------ Tax -------->
         <td><input class="form-control tax" type='number' id='tax1' name='tax[]' for="1"/></td>

         <!------ SubTotal -------->
         <td><input class="form-control total_cost" type='text' id='total_cost_1' name='total_cost[]' for='1' readonly/></td>
       </tr>           
    </tbody>
 </table>

Script to add new rows

<script>

var rowCount = 1;
 $( document ).ready(function() {
   $('#add').click(function() {
   rowCount++;
   $('#orders').append('<tr id="row'+rowCount+'"><td><button type="button" name="remove" id="'
+rowCount+'" class="btn btn-danger btn_remove circle">Remove</button></td><td><select style="width: 100%;" name="item'+rowCount+'" id="item'
+rowCount+'" class="browser-default custom-select-new"><option value="" disabled selected>Click to See Products</option><?php $records = mysqli_query($conn, "SELECT * FROM customer_product WHERE customer LIKE '$Comid' "); while ($data = mysqli_fetch_array($records)) { echo '<option value="' . $data['product'] . '" data-new_price_rate="' . $data['new_total_rate'] . '" data-description="' . $data['description'] . '" data-tax="' . $data['tax'] . '" >' . $data['product'] . '</option>'; } ?></select></td><td><input class="form-control" type="text" id="description'
+rowCount+'" name="description[]" for="'+rowCount+'"/></td><td><input class="form-control" type="number" id="product_price'
+rowCount+'" name="product_price[]" for="'+rowCount+'"/></td><input class="form-control" type="hidden" data-type="product_id" id="product_id_'
+rowCount+'" name="product_id[]" for="'+rowCount+'"/><td><input class="form-control" type="number" class="quantity" id="quantity_'
+rowCount+'" name="quantity[]" for="'+rowCount+'"/> </td><td><input class="form-control" type="number" id="tax'
+rowCount+'" name="tax[]"  for="'+rowCount+'"/> </td><td><input class="form-control" type="text" id="total_cost_'
+rowCount+'" name="total_cost[]"  for="'+rowCount+'" readonly/> </td></tr>');
  });
});

</script>

Script to get values from rows and new row values

<script>
for(let i=1; i<25; i++) {
let mySelect = document.getElementById("item" + i);

if (mySelect !== null) {

mySelect.addEventListener("change", () => document.getElementById("product_price" + i).value = mySelect.options[mySelect.selectedIndex].getAttribute("data-new_price_rate"))
mySelect.addEventListener("change", () => document.getElementById("description" + i).value = mySelect.options[mySelect.selectedIndex].getAttribute("data-description"))
mySelect.addEventListener("change", () => document.getElementById("tax" + i).value = mySelect.options[mySelect.selectedIndex].getAttribute("data-tax"))
console.log(mySelect);

    }
 }
</script>

How to load a Livewire component from a controller?

I had a fullpage Livewire component Contract, to create a contract, called directly from the routes in web.php:

Route::get('contract', AppHttpLivewire::class)->name('contract.create');

Now I want to switch to having a Resource Controller instead, so my web.php changes to:

Route::resource('contract', ContractController::class);

How can I load the Livewire component from the create function of the controller?
I tried:

class ContractController extends Controller
{
    public function create()
    {
        return view('livewire.contract');
    }

what is loading the view correctly, but it is missing all the data that I load from the mount function. Thus, I assume, it is just displaying the view without loading the Livewire class.

Displaying input error messages next to the input field

I would like to display error checking next to the input field. Currently, errors are displayed at the top of the page.

Maybe there is some way to check for input errors?
I could not find a similar example where html and php code are separated into different files
Or my code is completely wrong.

index.php

<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <title>testpage</title>
    </head>

    <body>
    <?php
require('process.php');
?>
        <h1>Form</h1>
        
        <form method="post" action="">
        <div>  Date : <input type="date" name="date"/><br />
</div>
            <div>
                   <label>Start:</label>
                    <select name="starttime" style="margin-right:15px" >
                         <option value="09:00:00">09:00</option>
                         <option value="17:00:00">17:00</option>
                    </select>
                   <label>End:</label>
                         <select name="endtime">
                      <option value="18:00:00">18:00</option>
                     </select>
                  <br>
            </div>
            <div>
            Name : <input type="text" name="user_name" placeholder="Name" /><br />
</div>
            Mail : <input type="email" name="user_email" placeholder="Mail" /><br />
            Message : <textarea name="user_text"></textarea><br />
            <input type="submit" value="Send" />
        </form>
        <h3 class=" txt_center">DB Output <span id="curdate">
       <?php require('calendar.php');
        ?>
            <!-- <script type="text/javascript" src="js/time-select.js"></script> -->
    </body>
</html>

process.php

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $u_date = filter_var($_POST["date"]);
    $u_starttime = $_POST["starttime"];
    $u_endtime = $_POST["endtime"];
    $u_name = filter_var($_POST["user_name"]); 
    $u_email = filter_var($_POST["user_email"], FILTER_SANITIZE_EMAIL);
    $u_text = filter_var($_POST["user_text"]);

    $error = array();
    if (empty($u_date)){
        $error['date'] = 'Date is empty!';
        }
    elseif ( $u_starttime > $u_endtime ){
        echo "*Incorrect time";
    }        
    elseif (empty($u_name)){
        echo "Name is empty.";
    }
    else{
    require_once('db-connect.php');
    
    $statement = $mysqli->prepare("INSERT INTO users_data (date, start_time, end_time, user_name, user_email, user_message) VALUES(?, ?, ?, ?, ?, ?)"); 
    
    $statement->bind_param('ssssss', $u_date, $u_starttime, $u_endtime,  $u_name, $u_email, $u_text); 
    
    if($statement->execute()){
    print "Hello, " . $u_name . "!, request is complete!";
    }else{
    print $mysqli->error; 
    }
}
}
?>

nextcloud rewrites config permissions after reboot

Heyhey!

i’m struggling with a permission-problem on my nextcloud instance.

My Setup is

  • Manjaro 21.0.7-210614 linux518
  • Nextcloud 24.0.3-1
  • Apache 2.4.54-1
  • php-sqlite 8.1.8-1
  • php-intl 8.1.8-1
  • php-imagick 3.7.0-2
  • php-gd 8.1.8-1
  • php-apcu 5.1.21-3
  • php-apache 8.1.8-1
  • php 8.1.8-1

My config folder keeps rewriting it’s permissions and as a result i’m getting an error every day:

Cannot write into "config" directory!
This can usually be fixed by giving the web server write access to the config directory. 
But, if you prefer to keep config.php 
file read only, set the option "config_is_read_only" to true in it.
See https://docs.nextcloud.com/server/24/go.php?to=admin-config

Every day, my permissions are like that:

   /usr/sh/we/ne/config  cls -la                                                         INT ✘  root@cloud 
  rwxrwxr-x   1   nextcloud   nextcloud     94 B     Sat Aug  6 11:10:29 2022    ./
  rwxr-xr-x   1   root        root          30 B     Sat Aug  6 11:10:29 2022    ../
  rwxrwxr-x   1   nextcloud   nextcloud      0 B     Tue Jul 19 21:28:06 2022    CAN_INSTALL 
  rwxrwxr-x   1   nextcloud   nextcloud      1 KiB   Sat Aug  6 10:59:43 2022    config.php 
  rwxrwxr-x   1   nextcloud   nextcloud     66 KiB   Tue Jul 19 21:28:06 2022    config.sample.php 
  rwxrwxr-x   1   nextcloud   nextcloud    495 B     Tue Jul 19 21:28:06 2022    .htaccess 

I have to rewrite them in order to get nextcloud working:

   /usr/sh/we/nextcloud/config  cls -la                                                      ✔  root@cloud
  rwxrwxr-x   1   nextcloud   http     94 B     Sat Aug  6 11:10:29 2022    ./
  rwxr-xr-x   1   root        root     30 B     Sat Aug  6 11:10:29 2022    ../
  rwxrwxr-x   1   nextcloud   http      0 B     Tue Jul 19 21:28:06 2022    CAN_INSTALL 
  rwxrwxr-x   1   nextcloud   http      1 KiB   Sat Aug  6 10:59:43 2022    config.php 
  rwxrwxr-x   1   nextcloud   http     66 KiB   Tue Jul 19 21:28:06 2022    config.sample.php 
  rwxrwxr-x   1   nextcloud   http    495 B     Tue Jul 19 21:28:06 2022    .htaccess 

User nextcloud is not part of group http!

Strangely the permissions in /etc/webapps/nextcloud are not affected by changing the symlinks. I have to cd into that folder and also change them by hand.

Whats that strange behaviour and how can i get nextcloud to keep my permissions?

How to insert a time from the suggested options into the datetime-local field

I want to create a booking script and I can’t solve the problem.
There is a form field for the date, I output the available time slots separately from the database. I want the selected time to appear in the datetime-local field when choosing a timeenter image description here

          <div class="form-group">
            <label for="date_sched" class="control-label">Appointment</label>
            <input type="datetime-local" class="form-control" name="date_sched" value="" required>
        </div>
        
        
        <?
        
        $sched_set_qry = $conn->query("SELECT * FROM `schedule_settings`");
        $sched_set = array_column($sched_set_qry->fetch_all(MYSQLI_ASSOC),'meta_value','meta_field');
        $a = date("Y-m-d ") . explode(',',$sched_set['morning_schedule'])[0];
        $b = date("Y-m-d ") . explode(',',$sched_set['morning_schedule'])[1];
        
        
        $period =new DatePeriod (
        new DateTime($a),
        new DateInterval ('PT1H'),
        new DateTime ($b)
        );
        foreach ($period as $date){?>
            
            
             <input type="button" class="form-control" name="time" value="<? echo $date->format("H:in")?>"  >
    <?  }
        
        ?>

i setup email sent on status update (status is in tinyint format) i want to display Status as “in progress” not the tiny int how can i do that?

/TemplateController

    public function invoice_status_upadated(Request $request){ 

        $data= Invoice::find($request->id);
        $oldstatus = $data->status;
        $data->status = $request->status;

        $data->save();


        $email = Auth::user()->email;
        $status = $data->status;
        $id = $data->id;
        

        $msg = [
            'email' => $email,
            'name' => Auth::user()->name,
            'oldstatus' => $oldstatus,
            'status' => $status,
            'id' => $id
                ];
                
        Mail::send('index.invStatusUpdate', $msg, function($msg) use($email){


        $msg->to($email)->subject('Invoice Status has been Changed');});

        return redirect('invoices');}

Emails/invStatusUpdate.blade.php

<html>
    <body>  
        <b>Hello {{$name}}<b><br>
        <p style="text-align:centre">Invoice ID: {{$id}} has been updated from {{$oldstatus}} to {{$status}} </p><br>
        <p>By {{$name}} </p>
    </body>
    </html>

Result in Email

Result in Email

i want to change these marked tinyint (0 and 1) to “Pending”,”in Process”

invoices/index.blade.php

                        <td>
                          <form action="{{url('/invoice_status_upadated')}}" method="POST">
                          <input class="form-control" name="id" type="hidden" value="{{$inv['id']}}">
                            
                            {{ csrf_field() }}
                            <div class="input-group mb-3">
                              <select class="form-select" aria-label="Default select example" name="status">
                            <option value="0" {{$inv->status == 0 ? 'selected':''}}>Pending </option>
                            <option value="1" {{$inv->status == 1 ? 'selected':''}}>In Process </option>
                            <option value="2" {{$inv->status == 2 ? 'selected':''}}>Completed </option>
                            <option value="3" {{$inv->status == 3 ? 'selected':''}}>Cancelled </option>
                              </select>
                        <button type="submit"  class="btn btn-outline-success">Update</button>
                        </div>
                          </form>
                        </td>   

Results on Status update page

Results on Status update page

I just want to change the format in the email (0,1,2,3) to (pending, In process, Completed, Cancelled

How to remove .php extension in godaddyhosting

My website address this
http://custom.example.net/HTML/html5-development.php

I want when I browse this without php then it should work http://custom.example.net/HTML/html5-development like this

I added below code in httaccess file

#remove html file extension https://example.com/page.php
# to https://example.com/page
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC, L]

<IfModule><If "%{REQUEST_URI} !~ m#^/HTML/assets/#">
  ExpiresActive on
  
  ExpiresByType text/css "access plus 1 month"
</If>


<Else> 
    <FilesMatch ".(css)$">
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    </FilesMatch>
</Else>

</IfModule> 

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

but it is not working. Can anyone please help

Html/Php Form Bug

I am using php, Apache server
IDK why this weird bug is happening to me
for example the code is ->

<form>
form elements,abc
</form>
extra stuff

so the browser is getting the code as

<form>
form elemnts,abc
extra stuff
</form>

this was just the example the real code is a bit more complex than this

even if I put the form end above the extra stuff
the browser puts the form at the end of the code again
any solutions?


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.tailwindcss.com"></script>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
  <title>Artificial Doctor</title>
  <style>
    body {
      background: #073B4C;
    }

    .heading {
      color: white;
    }
  </style>
</head>

<body><?php require('components/header.php') ?>
  <div class="pt-6 sm:pt-8 lg:pt-12">
    <div class="max-w-screen-2xl px-4 md:px-8 mx-autoflex">
      <h2 class="heading text-2xl lg:text-3xl font-bold text-center mb-4 md:mb-8">LOGIN</h2>
      <form class="max-w-lg border rounded-lg mx-auto" style="margin-bottom: 150px;" action="<?php $_PHP_SELF ?>">
        <div class="flex flex-col gap-4 p-4 md:p-8 bg-white">
          <div>
            <label for="email" class="inline-block text-gray-800 text-sm sm:text-base mb-2">Email</label>
            <input name="email" id="email" placeholder="Username OR [email protected]" class="w-full bg-gray-50 text-gray-800 border focus:ring ring-indigo-300 rounded outline-none transition duration-100 px-3 py-2" />
          </div>

          <div>
            <label for="password" class="inline-block text-gray-800 text-sm sm:text-base mb-2">Password</label>
            <input name="password" autocomplete="off" id="password" placeholder="PASSWORD@123" type=password class="w-full bg-gray-50 text-gray-800 border focus:ring ring-indigo-300 rounded outline-none transition duration-100 px-3 py-2" />
          </div>
          <div class="m-auto">
            <input type="checkbox" class="form-check-input" id="remember_me" name="remember_me">
            <label class="form-check-label" for="remember_me">Remember Me</label>
          </div>

          <button class="block bg-gray-800 hover:bg-gray-700 active:bg-gray-600 focus-visible:ring ring-gray-300 text-white text-sm md:text-base font-bold text-center rounded-lg outline-none transition duration-100 px-8 py-3" type="submit">Login</button>
      </form>

      <div class="flex justify-center items-center relative">
        <span class="h-px bg-gray-300 absolute inset-x-0"></span>
        <span class="bg-white text-gray-400 text-sm relative px-4"></span>
      </div>
      <button id="register" class="flex justify-center items-center bg-blue-500 hover:bg-blue-600 active:bg-blue-700 focus-visible:ring ring-blue-300 text-white text-sm md:text-base font-semibold text-center rounded-lg outline-none transition duration-100 gap-2 px-8 py-3" onclick="window.location.href ='http://localhost/doctor/register' ">
        <span class="material-symbols-outlined">how_to_reg</span>Register
      </button>

      <button class="flex justify-center items-center bg-blue-500 hover:bg-blue-600 active:bg-blue-700 focus-visible:ring ring-blue-300 text-white text-sm md:text-base font-semibold text-center rounded-lg outline-none transition duration-100 gap-2 px-8 py-3">
        <span class="material-symbols-outlined">password</span>Forgot Password
      </button>
    </div>
  </div>
  <?php require('components/footer.php') ?>
</body>
</html>

I want to add PHP code in my websites. Can some one help me about this? I already have PHP code but don’t know how to input it [closed]

API 2.0
HTTP Method POST
API URL https://premiumaccountoriginal.com/api/v2
Response Format JSON
Method:add
Parameters  Descriptions
api_token   Your API token
action  Method Name
package ID of package
link    Link to page
quantity    Needed quantity
custom_data optional, needed for custom comments, mentions and other relaed packages only.
each separated by 'n', 'nr'
Success Response:

{
  "order":"23501"
}
Method:status
Parameters  Descriptions
api_token   Your API token
action  Method Name
order   Order ID
Success Response:

{
  "status": "Completed",
  "start_counter": "600",
  "remains": "600"
}
Method:balance
Parameters  Descriptions
api_token   Your API token
action  Method Name
Example Response:

{
  "balance": "100.78",
  "currency": "USD"
}

Method:packages
Parameters  Descriptions
api_token   Your API token
action  Method Name
Example Response:

[
  {
    "id":"1",
    "name":"Instagram Followers",
    "type":"default"
  },
  {
    "id":"2",
    "name":"Instagram Likes",
    "type":"default"
  },
  {
    "service":"3",
    "name":"Facebook Custom Comments",
    "type":"custom_data"
  }
]

Undefined property: DOMDocument::$documentElement

i have a problem with this package on shared-hosting while i haven’t this problem on localhost

gives me the error:

{
"message": "Undefined property: DOMDocument::$documentElement",
"exception": "ErrorException",
"file": "/home/h189025/public_html/system/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php",
"line": 132,
"trace": [
{
"file": "/home/h189025/public_html/system/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php",
"line": 132,
"function": "handleError",
"class": "IlluminateFoundationBootstrapHandleExceptions",
"type": "->"
},
{
"file": "/home/h189025/public_html/system/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php",
"line": 50,
"function": "getHtmlFromDocument",
"class": "TijsVerkoyenCssToInlineStylesCssToInlineStyles",
"type": "->"
},
{
"file": "/home/h189025/public_html/system/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php",
"line": 74,
"function": "convert",
"class": "TijsVerkoyenCssToInlineStylesCssToInlineStyles",
"type": "->"
},
....
]
}

enter image description here

file_get_contents data can not be scarped

This is the code

$link = "https://www.apple.com/au/search/medication-management?src=globalnav";
$str = file_get_contents($link);
//$str= '<a href="https://apps.apple.com/au/app/medicinewise-manage-medicine/id777483494" class="rf-serp-productname-link">MedicineWise: Manage Medicine</a>';
$pattern="/<a href=".+" class="rf-serp-productname-link">/";
if(preg_match_all($pattern, $str, $matches)) {
  print_r($matches);
}

Inisde $str there is

`<a href="https://apps.apple.com/au/app/medicinewise-manage-medicine/id777483494" class="rf-serp-productname-link">MedicineWise: Manage Medicine</a>

So expected output is

Array
(
    [0] => Array
        (
            [0] => <a href="https://apps.apple.com/au/app/medadvisor-medications-manager/id626138245" class="rf-serp-productname-link">
        )

)

I get this ouput when I define $str manually. But when I get content from the link I am not getting desired result.

How to comment a function using DocBlock

How can i specify that I’m setting the property $nAds

I was thinking to something like:

@set $nAds

but it didn’t worked

This is what I’m using

/**
 * Extract the number of ads of a province and set the property $nAds
 * 
 * @param string $html         The html of the first classified page
 */
private function extract_nPag($html){
    preg_match('/<strong>([0-9]+)</strong>/iU', $html, $result);
    $result[1] = str_replace(".", "", $result[1]);
    $this->nAds =  $result[1];
    }

Google Services like fcm and map Response Delayed unexpectedly

guys I am facing very strange issue, everything was working fine two days ago, all of sudden google map and fcm push notifications started taking to much time in giving response.sometime they give response within a milliseconds sometime the take almost 75 seconds or more, everything working fine on local machine, this issue is happening on live server.our live server is Scala vps, day before yesterday i asked them to change my supervisor config, and after they change and restart supervisor these issues start arising, after that they stop supervisor but still things are not getting back to normal, i asked Scala team a lot about anything they change in server config but they are saying everything is normal on their end. i deployed same code on another server it is working fine their, the api’s which are delaying responses are google map directions ,distance matrix apis and fcm push notifications api, all other external services api working fine, very strange, i am using guzzel http liabrary to call google directions api, i tried with simple curl but still no luck.and this is my very simple code

            $d_latitude = $request->d_latitude;
            $d_longitude = $request->d_longitude;
            $apiurl = "https://maps.googleapis.com/maps/api/directions/json?origin=" . $s_latitude . "," . $s_longitude . "&destination=" . $d_latitude . "," . $d_longitude . "&mode=driving&sensor=false&units=metric&key=" . Setting::get('map_key')."&alternatives=true";
            $client = new Client;
            $location = $client->get($apiurl);
            $location = json_decode($location->getBody(), true);