Support » Plugin: Woody code snippets - Insert Header Footer Code, AdSense Ads » file_get_contents NOT WORKING

  • Resolved eidosik

    (@eidosik)


    hi, please help, I need to read div content from another site but I get error:

    Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/pu026100/www_root/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(45) : eval()'d code on line 1
    
    Warning: file_get_contents(https://restauracie.sme.sk/restauracia/hotel-teledom_263-kosice_2914/denne-menu/): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/pu026100/www_root/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(45) : eval()'d code on line 1

    my code:

    $data = file_get_contents("https://restauracie.sme.sk/restauracia/hotel-teledom_263-kosice_2914/denne-menu/"); 
    
    preg_match_all("/<div class=\"jedlo_polozka\">\s+<div class=\"left\">\s+(.*?)\s+<\/div>\s+<span class=\"right\"><b>(.*?)<\/b><\/span>\s+<\/div>\s+<div class=\"delimiter\"><\/div>/", $data, $hlavnejedlo);
    preg_match_all("/<div class=\"jedlo_polozka\">\s+<div class=\"left\">\s+(.*?)\s+<\/div>\s+<\/div>\s+<div class=\"delimiter\"><\/div>/", $data, $polievka);

    Thanks so much 🙂

    • This topic was modified 2 years, 6 months ago by eidosik.
    • This topic was modified 2 years, 6 months ago by eidosik.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi

    It looks like some trouble with DNS-resolving or outgoing connection on your server.

    1. Please, contact your hosting technical support.
    2. Or if you have permission, try setup Google DNS on your server. Read more

    Best regards

Viewing 1 replies (of 1 total)
  • The topic ‘file_get_contents NOT WORKING’ is closed to new replies.