Trying to run PHP code to submit values in tablepress cell
-
Hello,
I’m trying to use PHP to submit a value to a tablepress table cell.
This is the code:
<?php // Defining the basic cURL function function curl($url) { $ch = curl_init(); // Initialising cURL curl_setopt($ch, CURLOPT_URL, $url); // Setting cURL's URL option with the $url variable passed into the function curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL's option to return the webpage data $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable curl_close($ch); // Closing cURL return $data; // Returning the data from the function } // Defining the basic scraping function function scrape_between($data, $start, $end){ $data = stristr($data, $start); // Stripping all data from before $start $data = substr($data, strlen($start)); // Stripping $start $stop = stripos($data, $end); // Getting the position of the $end of the data to scrape $data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape return $data; // Returning the scraped data from the function } $scraped_website = curl("http://exchange.nagios.org/directory/Plugins/Operating-Systems/Windows/NRPE/Check-Microsoft-Windows-Scheduled-Tasks/details"); $scraped_data = scrape_between($scraped_website,'Hits</div><div class="data">','</div></div><div class="row">'); echo $scraped_data ?>It works when I run it at home in my WAMP server, but it does not display anything in the tablepress table http://outsideit.net/check_ms_win_tasks/
I have php in tables extension for Tablepress installed.
Is there anything I’m doing wrong? Is there anything I can do to make it work?Thanks for any advice on this.
Grtz
Willem
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Trying to run PHP code to submit values in tablepress cell’ is closed to new replies.