simple_html_dom: simple use-case - gettin a scipt to work

hi there good day dear OpenSuse-experts,

the issue today: simple_html_dom: simple use-case - gettin a scipt to work

Well - this is somewhat a headstart i fairly new to simple_html_dom usage and methods. I know a little the parser,

i want to gather some information from this site:https://europa.eu/youth/volunteering/organisations_en#open

is this possible to get the content - of let us say 10 or 20 last records on that page - and subesquently to store it in my mysql - db!?


<?php
// Report all PHP errors (see changelog)
error_reporting(E_ALL);


include('inc/simple_html_dom.php');


    //base url
    $base = 'https://europa.eu/youth/volunteering/organisations_en#open';


    //home page HTML
    $html_base = file_get_html( $base );


    //get all category links
    foreach($html_base->find('a') as $element) {
        echo "<pre>";
        print_r( $element->href );
        echo "</pre>";
    }


    $html_base->clear(); 
    unset($html_base);


?><?php
// Report all PHP errors (see changelog)
error_reporting(E_ALL);


include('inc/simple_html_dom.php');


    //base url
    $base = 'https://europa.eu/youth/volunteering/organisations_en#open';


    //home page HTML
    $html_base = file_get_html( $base );


    //get all category links
    foreach($html_base->find('a') as $element) {
        echo "<pre>";
        print_r( $element->href );
        echo "</pre>";
    }


    $html_base->clear(); 
    unset($html_base);


?>

I have the above code and I’m trying to get certain elements of the page but it isn’t returning anything. Is it possible that certain PHP functions might be disabled on the server to stop that?
The above code works perfectly on other sites.


<br/>
<b>Warning</b>:  include(inc/simple_html_dom.php): failed to open stream: No such file or directory in <b>...]...]</b> on line <b>5</b><br/>
<br/>
<b>Warning</b>:  include(): Failed opening 'inc/simple_html_dom.php' for inclusion (include_path='.:') in <b>...]...]</b> on line <b>5</b><br/>
<br/>
<b>Fatal error</b>:  Uncaught Error: Call to undefined function file_get_html() in ...]...]:11
Stack trace:
#0 {main}
  thrown in <b>...]...]</b> on line <b>11</b><br/>


findings: As the error states, i think that simple_html_dom.php either doesn’t exist or isn’t in the right location.

furthermore: since file_get_html is not a native PHP function, the function resides within my included file that cannot be found so i need to to fix that first. The filed does not exist by checking the inc folder in the project root. i am going to fix it.

so the **question is: **

this is my** project-folder: **

/project
/project/includes/

question: does the above mentioned file resides in that folder - the includes file!?

love to hear from you


**it looks like so: **

C:Users\Kasper\Documents_mk__dev_\php\ ->here my_project-file_
C:Users\Kasper\Documents_mk__dev_\php\includes (and here the “simplehtmldom-parser” from PHP Simple HTML DOM Parser download | SourceForge.net goes in https://forums.opensuse.org/image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

i am going to testrun now the whole thing on my machine - using ATOM 

i come back later the day 
love to hear from you
regards

You have a folder ‘includes’ where the script looks in ‘inc’.

ohhhhhhhhhhhhhhhhhhhhh - youre right dear knurpht.

many thanks for this valuable hint!!

i am going to correct it!! :wink: