I have a short php file that collects data from a certain URL using Simple HTML Dom.
This script works fine when I run it, but I'm trying to include it in a Wordpress plugin and save the values in some custom fields but it fails with the following error.
PHP Fatal error: Call to a member function find() on a non-object in /Users/duncan/Webserver/wordpress/wp-content/plugins/booking-scores/simple_html_dom.php on line 1113
The code I have is as follows:
<?php
include_once('../../../wp-load.php');
$site = get_field('booking_url', 'options');
include_once('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file($site);
// get values...
$score = $html->find( '#review_list_main_score', 0 )->innertext;
etc...
this is fine running on its own, but once it is in the plugin with
include_once('../../../wp-load.php');
$html is always a non-object.
Is Simple HTML Dom not compatible with wordpress, or is there something I am missing here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire