dil_bert Posted February 18, 2018 Share Posted February 18, 2018 good day dear opensuse-experts,running opensuse 42.3 - i look forward to the release of Version 15 i just run some scripts that need the inclusion of simple_html_dom. i need to put this into the same folder, in which my testscript resides:btw-, the projectpage looks like down : see http://simplehtmldom.sourceforge.net/manual.htminclude('simple_html_dom'); Project web is currently offline pending the final migration of its data to our new datacenter. https://sourceforge.net/projects/simplehtmldom/ funny: i download it form Sourceforge:But: what is pretty important: The php-extension (simple_html_dom) should be found by my testscript.conditions: It should probably include(simple_html_dom.php);in other words: it's should be in the same folder as my testscript:if not - then i would need to use the relative path to it.So i have two options.a- put the extension into the same folder as the testscript remains orb- use the correct pathhow to apply the option a - putting the extension to the same folder? Quote Link to comment https://forums.phpfreaks.com/topic/306579-simple_html_dom-where-to-put-it-if-i-run-a-testsript/ Share on other sites More sharing options...
requinix Posted February 19, 2018 Share Posted February 19, 2018 I don't understand why you're asking how to put a file into a directory. It's not an extension. It's a PHP file. Possibly many files, I don't know. Quote Link to comment https://forums.phpfreaks.com/topic/306579-simple_html_dom-where-to-put-it-if-i-run-a-testsript/#findComment-1556558 Share on other sites More sharing options...
Psycho Posted February 20, 2018 Share Posted February 20, 2018 The Simple Html Dom class is just a single file. There is no reason you can't put it anywhere you want to put it. If this is just for a test script as you say, just put it into the same folder as your test script. However, if this was for a real application, then you would want to put it into an 'includes' folder - or some other folder that will hold dependent code for your application. If you are using a framework, that framework may have predetermined locations for such files. Quote Link to comment https://forums.phpfreaks.com/topic/306579-simple_html_dom-where-to-put-it-if-i-run-a-testsript/#findComment-1556585 Share on other sites More sharing options...
dil_bert Posted February 22, 2018 Author Share Posted February 22, 2018 hello dear Requinix hello dear Psycho, many many thanks for the quick reply - the issues i have had arised / and were shown here: see this thread: https://forums.phpfreaks.com/topic/306539-extract-values-of-attributes-of-elements-with-simple-html-dom-parser/ i just tried out this <?php include('simple_html_dom'); $url = 'https://wordpress.org/plugins/wp-job-manager/'; $html = file_get_html($url); $text = array(); foreach($html->find('DIV[class="widget plugin-meta"]') as $text) { $text[] = $text->plaintext; } print_r($headlines); ?> with a quick try i ve gotten this back: martin@linux-3645:~/dev/php> php p100.php PHP Warning: include(simple_html_dom): failed to open stream: No such file or directory in /home/martin/dev/php/p100.php on line 4 PHP Warning: include(): Failed opening 'simple_html_dom' for inclusion (include_path='.:/usr/share/php5:/usr/share/php5/PEAR') in /home/martin/dev/php/p100.php on line 4 PHP Fatal error: Call to undefined function file_get_html() in /home/martin/dev/php/p100.php on line 6 martin@linux-3645:~/dev/php> php can't find simple_html_dom you're missing the php extensionIt should probably be include(simple_html_dom.php); then if it's not in the same folder as your p100.php then you'll need to use the relative path to it. sure thing - my fault; ive forgotten to put the simple_html_dom into place.... greetings Quote Link to comment https://forums.phpfreaks.com/topic/306579-simple_html_dom-where-to-put-it-if-i-run-a-testsript/#findComment-1556647 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.