I downloaded the Simple Html DOM library files, and using this piece of code on top of my .php
file I managed to call the simple_html_dom file ( note that I am running this on a server thus I used the built in php function getcwd() to call the directory of the project's folder ).
CODE:
<?php
$hard_path = getcwd().'/';
require_once "$hard_path".'simple_html_dom.php';
Moving on I am interested in returning
or echoing
the html content of this URL, https://www.skroutz.gr/s/36232462/Asus-TUF-Dash-F15-FX516PC-HN004W-15-6-FHD-144Hz-i7-11370H-16GB-512GB-SSD-GeForce-RTX-3050-W11-Home-US-Keyboard.html?from=home_price_drops
.
PROBLEM:
To simply echo
the html content of the url, I used the Simple HTML DOM's library function called file_get_html(). But when I use the code below to echo the content of the page I get no output( note that this happens only with skroutz.gr
wepsite links and incase I use a different link for example from wikipedia or any other site in general I do get content in the output of my .php
file ). Also there are no errors being returned.
code:
$dom = file_get_html('https://www.skroutz.gr/s/36232462/Asus-TUF-Dash-F15-FX516PC-HN004W-15-6-FHD-144Hz-i7-11370H-16GB-512GB-SSD-GeForce-RTX-3050-W11-Home-US-Keyboard.html?from=home_price_drops');
echo $dom;
COMPLETE CODE:
<?php
$hard_path = getcwd().'/';
require_once "$hard_path".'simple_html_dom.php';
$dom = file_get_html('https://www.skroutz.gr/s/36232462/Asus-TUF-Dash-F15-FX516PC-HN004W-15-6-FHD-144Hz-i7-11370H-16GB-512GB-SSD-GeForce-RTX-3050-W11-Home-US-Keyboard.html?from=home_price_drops');
echo $dom;
QUESTIONS:
- Why am I not getting any output when I try to read skroutz.gr's weblinks?
- Are there any mistakes in my code that I should be aware of?
Thanks in advance for your time and effort!