Skip to content
Advertisement

Laravel 8 implement PHP’s DOM XML functions to output XML

I am new to the Laravel PHP framework, so I am not so familiar with it. I need some help implementing the sample code from Google Maps. To retrieve the latitude longitude. And also, some info from a database that I created locally in PHPMyAdmin for markers. The problem I have is that Laravel doesn’t recognize MySQL functions (undefined functions). I saw in documentation that it uses facades DB::raw(your SQL), but I tried to implement it without a result. I don’t upload any code because I just created the skeleton and take the code from Google Maps API. I found that MySQLi replaced MySQL functions, so I modified the code, but I still not figured out the domxml_new_doc("1.0").

JavaScript

Advertisement

Answer

domxml_new_doc() is an old PHP 4 function and does not exists in current PHP. Use the DOMDocument class and its methods.

Here is an example:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement