Compare external data with Section Entries (Custom Datasource)
This is an open discussion with 1 reply, filed under General.
Search
Done!
It turns out to be very simple.
Here's the DS code: <?php
require_once(TOOLKIT . '/class.datasource.php'); Class datasourceUser_IP extends Datasource{ function about(){ return array( 'name' => 'User IP', 'author' => array( 'name' => 'Fabio Pittol', 'website' => 'http://zero27.com', 'email' => 'info@zero27.com'), 'version' => '1.0', 'release-date' => '2011-08-29T12:00:00+00:00'); } function grab(&$param_pool){ $getIP = $_SERVER['REMOTE_ADDR']; $result = new XMLElement("user-ip"); $ip_node = new XMLElement("ip", $getIP); $result->appendChild($ip_node); return $result; } } ?>
And the XML:
<user-ip> <ip>127.0.0.1</ip> </user-ip>
Create an account or sign in to comment.
Hi guys,
As I'm such a noob with PHP seems like I need a little help. Here's the deal:
I'm using the following DS code (based on Nick Dunn's Tag List)
<?php
?>
What I'm acctually trying to do is to general a XML with the user's IP in order to check with but I just can't imagine how to go from /THE UNKNOWN/ :D to a XML result.