0

I have this script in my functions PHP, WP 4.8

function foobar_func( $atts ){
    require_once('ftp://skkelticz@ftpx.forpsi.com/www/wp-content/themes/sporty-child/simple_html_dom.php');
    $html = file_get_html('http://hokejbal.cz/1-liga/tabulky/');
    $ret = $html->find('table.standings', 1);
    print $ret;

}
add_shortcode( 'foobar', 'foobar_func' );

When I put the shortcode into my page, it gives me three errors, which I dunno how to repair. Please give me some advice:

Warning: require_once(): ftp:// wrapper is disabled in the server configuration by allow_url_include=0 in /web/htdocs2/skkelticz/home/www/wp-content/themes/sporty-child/functions.php on line 11

Warning: require_once(ftp://...@ftpx.forpsi.com/www/wp-content/themes/sporty-child/simple_html_dom.php): failed to open stream: no suitable wrapper could be found in /web/htdocs2/skkelticz/home/www/wp-content/themes/sporty-child/functions.php on line 11

Fatal error: require_once(): Failed opening required 'ftp://...@ftpx.forpsi.com/www/wp-content/themes/sporty-child/simple_html_dom.php' (include_path='.') in /web/htdocs2/skkelticz/home/www/wp-content/themes/sporty-child/functions.php on line 11

ragulin
  • 224
  • 2
  • 18
  • 1
    You should really think of using built-in DOM functions instead `simplehtmldom`. – revo Jul 30 '17 at 15:59
  • built in dom functions? @revo – ragulin Jul 30 '17 at 16:07
  • 3
    Troubleshooting 101: Learn to read the errors. What it's saying is: You can't use an `ftp://...` protocol in a `require_once`. The file, I would hope, is actually on your server - so use a function such as [plugin_dir_path](https://developer.wordpress.org/reference/functions/plugin_dir_path/) to get the path to your required files. (Hint: Start with the first error. Solving it will likely resolve the other two in this case) – random_user_name Jul 30 '17 at 17:27
  • @cale_b it isnt on my server, but I can do it, dont worry about own rights in this case – ragulin Jul 30 '17 at 19:46
  • 1
    What you need to realize when you do stuff like that is that someone can change that file to make it delete everything on your server. – pguardiario Jul 30 '17 at 21:13

0 Answers0