Hello,
I hope some one can help me with this.
I need to output xml data from a remote server into a pulldown menu.
This is what i already done.
<?
$url = "https://secure.virtuele kassa.nl/api/xml/ideal.asp";
$page = "/ideal.asp";
$request_xml = "<?xml version=\"1.0\" ?>\n";
$request_xml .= "<request>\ n";
$request_xml .= "<test>true </test>\n";
$request_xml .= "<type>banklist </type>\n";
$request_xml .= "</request>\n";
$post_string = $request_xml;
$header = "POST ".$url." HTTP/1.0 \r\n";
$header .= "MIME-Version: 1.0 \r\n";
$header .= "Content-type: application/PTI26 \r\n";
$header .= "Content-length: ".strlen($post_ string)." \r\n";
$header .= "Content-transfer-encoding: text \r\n";
$header .= "Request-number: 1 \r\n";
$header .= "Document-type: Request \r\n";
$header .= "Interface-Version: Test 1.4 \r\n";
$header .= "Connection : close \r\n\r\n";
$header .= $post_string;
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL, $url);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ch , CURLOPT_TIMEOUT , 4);
curl_setopt($ch , CURLOPT_CUSTOMR EQUEST, $header);
curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, FALSE);
$data = curl_exec($ch);
if (curl_errno($ch )) {
print curl_error($ch) ;
} else {
// just for testing
print ("$data");
curl_close($ch) ;
}
?>
When i run the file i get this.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<type>banklis t</type>
<bank>
<bankid>0031</bankid>
<bankname>ABN Amro</bankname>
</bank>
<bank>
<bankid>0081</bankid>
<bankname>Forti s</bankname>
</bank>
<bank>
<bankid>0721</bankid>
<bankname>Postb ank</bankname>
</bank>
<bank>
<bankid>0021</bankid>
<bankname>Rabob ank</bankname>
</bank>
<bank>
<bankid>0751</bankid>
<bankname>SNS Bank</bankname>
</bank>
</response>
This works fine, but how can i put this $data into a pulldown menu.?
Please if you can help me with a working sample you make me real happy.
Thank you
Hans
2 1465
Hey Hank,
I do something very similar with an xml file and php.
I use preg_match_all and preg_match loops.
Not sure if you are making the xml locally or if it comes from the remote server,
to get the xml, i use this, but the content is already in xml on the remote server
I use this to get my xml page -
// Get the xml page
-
$url = "address where xml is located";
-
$data = implode("", file($url));
-
but once you have the xml in a variable (as above) you can use the below
I think you would want something like this -
-
-
echo "<select name=\"banks\">";
-
// Get each bank
-
preg_match_all ("/<bank>([^`]*?)<\/bank>/", $data, $matches);
-
-
// then go through each to get the bank details from the xml
-
-
foreach ($matches[0] as $match) {
-
-
// get bankid
-
preg_match ("/<bankid>([^`]*?)<\/bankid>/", $match, $temp);
-
$bankid = $temp['1'];
-
-
// get bankname
-
preg_match ("/<bankname>([^`]*?)<\/bankname>/", $match, $temp);
-
$bankname = $temp['1'];
-
-
echo "<option value=\"$bankid\">$bankname</option";
-
}
-
Thank you for repllying,
this is what i was looking for, it works great!
The xml file is recived from a remote server.
Gr. Hans
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sofia |
last post by:
My name is Sofia and I have for many years been running a personals site,
together with my partner, on a non-profit basis. The site is currently not
running due to us emigrating, but during its last year we got traffic of
between 2000 - 2500 unique visitors per day. We are now about to re-launch
the site from Sweden and we need to purchase a script to run it.
Having looked at what is available on the net I have realised that we need a...
|
by: Robert Maas, see http://tinyurl.com/uh3t |
last post by:
System login message says PHP is available, so I tried this:
http://www.rawbw.com/~rem/HelloPlus/h.php
It doesn't work at all. Browser just shows the source.
What am I doing wrong?
|
by: Gregory Nans |
last post by:
hello,
i need some help to 'tree-ify' a string...
for example i have strings such as :
s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i
need))"""
and i need to parse them to have a tree representation such as :
|
by: Mike Kamermans |
last post by:
I hope someone can help me, because what I'm going through at the moment
trying to edit XML documents is enough to make me want to never edit XML
again.
I'm looking for an XML editor that has a few features that you'd expect
in any editor, except nearly none of them seem to have:
1 - Search and repalce with Regular Expressions.
2 - Search and Replace in an Xpath context.
3 - User specified tag-generation for either on a...
|
by: JustSomeGuy |
last post by:
I need to write an new class derived from the list class.
This class stores data in the list to the disk if an object
that is added to the list is over 1K in size.
What methods of the std stl list class must Ioverride in order for this
to work?
| |
by: Bob.Henkel |
last post by:
I write this to tell you why we won't use postgresql even though we wish we
could at a large company. Don't get me wrong I love postgresql in many
ways and for many reasons , but fact is fact. If you need more detail I
can be glad to prove all my points. Our goal is to make logical systems.
We don't want php,perl, or c++ making all the procedure calls and having
the host language to be checking for errors and handleing all the...
|
by: Michael R. Pierotti |
last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$")
Dim m As Match = reg.Match(txtIPAddress.Text)
If m.Success Then
'No need to do anything here
Else
MessageBox.Show("You need to enter a valid IP Address", "Error!",
MessageBoxButtons.OK, MessageBoxIcon.Hand)
txtIPAddress.Focus()
Return
End If
|
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only the
sequence nos and it should be such that i can access it through the
structure .plz help me .
|
by: Alan Mailer |
last post by:
A project I'm working on is going to use VB6 as a front end. The back
end is going to be pre-existing MS Access 2002 database tables which
already have records in them *but do not have any AutoNumber* fields
in them.
Correct me if I'm wrong, but I'm assuming this means that I cannot now
alter these existing Access tables and change their primary key to an
"AutoNumber" type.
If I'm right about this, I need some suggestions as to the...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need Inbox
Reply
from Craig Somerford <uscos@2barter.net>
hide details 10:25 pm
(3 minutes ago)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |