hi
i found it very hard to do this (title says all) i got a site where it suppose to be a php script but i cant seem to use it...
http://xml.heroesofnewerth.com/
Fetch Data,statistic from another server/database
Moderator: General Moderators
Re: Fetch Data,statistic from another server/database
This script requires you to have the 'curl' extension enabled on your apache web server.
Don't quote me on everything though.. im still newish to working with xml
You should really check out tutorials on how to use XMl inside php
W3Schools as a basic example
Code: Select all
function loadXML($url){
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
$xmlData = loadXML('yoururl');
$heroName = $xmlData->hero_usage[0]->stat[0];
//where "hero_usage[x]" would be your first XML entry (x = 0,1,2,3,4,etc)
//ie. hero_usage[0] would be:
//<hero_usage hid='2'>
// <stat name='cli_name'>Hero_Armadon</stat>
// <stat name='used'>33933</stat>
//</hero_usage>You should really check out tutorials on how to use XMl inside php
W3Schools as a basic example
Re: Fetch Data,statistic from another server/database
ye i have read basic xml but never seen about xml in php... anyway thanks for the php script
edit: on $xmlData = loadXML('yoururl');... i am supposed to put "http://xml.heroesofnewerth.com/xml_requester.php" in there?
edit: on $xmlData = loadXML('yoururl');... i am supposed to put "http://xml.heroesofnewerth.com/xml_requester.php" in there?
Re: Fetch Data,statistic from another server/database
how do i know if i got 'curl' extension??
EDIT: well it seems i dont got it...
Fatal error: Call to undefined function curl_init() in /home/vg5/public_html/honfetch.php on line 4
EDIT: well it seems i dont got it...
Fatal error: Call to undefined function curl_init() in /home/vg5/public_html/honfetch.php on line 4
Re: Fetch Data,statistic from another server/database
btw maybe i was a abit unclear.. the site i linked is not my site... it is the server i want to retrieve the data from to my site