'Simple HTML DOM parser Wordpress

I am using Simple Html dom parser to get simple data from other websites and then be able to paste it into my wordpress pages via shortcode using elementor. I created a simple plugin which I uploaded together with 'simple_html_dom.php' libary. The plugin is this:

   <?php
include('simple_html_dom.php');

function web_name(){
    
$html=file_get_html("https://www.google.com/");

return $html->find('title', 0);
}

add_shortcode( 'name2' ,'web_name' );

?>

It works properly in local through XAMMP and VScode but when I include this [name2] shortcode in Elementor I only get blank, not even error.

If I modify the plugin function with:

return "Hello";

The shortcode works fine. Thanks



Sources

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

Source: Stack Overflow

Solution Source