Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
I was looking for a way to put the exchange rate of the UK currency in a pal-box. I found the following, but still I am not able to get this working

[]The easiest way to process XML data is using XPath statements. XPath allows you to reference the contents of an XML document almost as easily as you refer to directories and files on a disk.
Have a look at the PHPXPath project on Sourceforge:

http://sourceforge.net/projects/phpxpath/

If you download phpxpath into a directory; you can get the EUR:GBP exchange rate using the following code:
[]<?php

require("XPath.class.php");

$xp = new XPath();

$xp->importFromFile("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml");

$EUR_GBP_rate = $xp->getAttributes("//Cube[@currency='GBP']","rate");

echo($EUR_GBP_rate);

?>
[/]
[/]
My knowledge of php is very poor, so any help is appreciated!

Thanks

Sponsored Links
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
> but still I am not able to get this working

How far have you got it to work? Any error messages?

Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
All I did so far: [*]downloaded XPath.class.php [*]put the file in my pals dir [*]created an empty custombox9pal.php file and pasted the above code in it. [*] Brought up custombox9pal.php and got the following error:

[]Warning: main(XPath.class.php): failed to open stream: No such file or directory in /hsphere/local/home/pasqual/tsjechie.net/forum/pals/custombox9pal.php on line 2
Fatal error: main(): Failed opening required 'XPath.class.php' (include_path='.:/usr/local/lib/php') in /hsphere/local/home/pasqual/tsjechie.net/forum/pals/custombox9pal.php on line 2[/]


Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
I haven't looked at this yet - but if you can get it working on another page - open it up in the pal box in an inline frame.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
The error message says that there is no file XPath.class.php in your directory.
custombox9pal.php and XPath.class.php have to be in the same directory for the above php code to work!

Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
see this line require("XPath.class.php");
have your tried require("/full/path/to/file/XPath.class.php");

Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
[]scroungr said:
have your tried require("/full/path/to/file/XPath.class.php"); [/]

Great, that did the trick

Thanks all!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240505)