'php get lat and lang from google maps iframe embed link

for a reason, I had to save the location in DB as serialized HTML iframe.

s:379:"<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d115989.50812152277!2d46.7009536!3d24.7037952!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3e2f1d473b1026c3%3A0x4960fef594bbe871!2sDr.%20Sulaiman%20Al%20Habib%20Hospital!5e0!3m2!1sen!2ssa!4v1641125226839!5m2!1sen!2ssa" width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>";

I want to extract longitude and latitude from the src link. I do the following:

  $unserialized = unserialize($location);
        $exploded = explode('"', $unserialized);
        $url = $exploded[1];
        $numbers = preg_replace("/[^0-9.]/", '', $url);

        dd( explode('.', $numbers) );

the result is:

array:8 [
  0 => ""
  1 => ""
  2 => "118112131115989"
  3 => "50812152277246"
  4 => "7009536324"
  5 => "70379522310203032110242768413"
  6 => "1331210321473102633049605948712"
  7 => "20202020503212416411252268395212"
]

Is that right? if yes which numbers are what am looking for? Thanks



Solution 1:[1]

Src link is format as follows

https://maps.google.com/maps?q='+YOUR_LAT+','+YOUR_LON+'&hl=es&z=14&amp;output=embed

You can take reference from embedded map format

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1