Jump to content

simple_html_dom: where to put it if i run a testsript?


Recommended Posts

good day dear opensuse-experts,

running opensuse 42.3 - i look forward to the release of Version 15 wink.png



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.htm
include('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 or
b- use the correct path


how to apply the option a - putting the extension to the same folder?

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.

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 extension


It 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
 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.