473,233 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

Haveing trouble aquiring an xml document

I am making a soap request to an amazon server and trying to parse the
xml. The request -

http://webservices.amazon.co.uk/onca...seGroup=Medium

is succesful in my browser. But I can't get it into my script.

<?php
$parser=xml_parser_create();
xml_set_element_handler($parser,"start_handler","e nd_handler");
xml_set_character_data_handler($parser,"character_ handler");
xml_parser_set_option($parser,XML_OPTION_CASE_FOLD ING, 0);

$soap=fopen("http://webservices.amazon.co.uk/onca/xml?Service=AWSECommerceService&SubscriptionId=0PH DGJJ5S75MM3PERG02&Operation=ItemSearch&SearchIndex =Books&Keywords=liverpool&ResponseGroup=Medium","r ");

xml_parse ($parser,$soap) or die (format_error($parser));
xml_parser_free($parser);
.....
....?>

returns an XML ERROR (2) Syntax error.

Is it that fopen is not the correct way to aquire the xml ?

Thank you

Oct 5 '05 #1
2 1308
$soap=fopen("http://webservices.amazon.co.uk/onca/xml?Service=AWSECommerceService&SubscriptionId=0PH DGJJ5S75MM3PERG02&Operation=ItemSearch&SearchIndex =Books&Keywords=liverpool&ResponseGroup=Medium","r ");
xml_parse ($parser,$soap) or die (format_error($parser));


Don't pass the file handle to xml_parse(). Get some data from the file
handle and pass that. You can either get /all/ the data and pass it in
one lump, or make multiple calls to fread() and pass each chunk until
there's no more to read.

while( !feof($soap) )
{
$xmldata = fread($soap,1024);
xml_parse($parser,$xmldata) or die( ... );
}
fclose($soap);
xml_parser_free($parser);

---
Steve

Oct 5 '05 #2
Of course. Thank you v much

Oct 6 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tor Hovland | last post by:
I'm trying to transform the document element of incoming xml files, however, I'm having trouble with namespace references not appearing correctly. Here's an example input file: <?xml...
8
by: lawrence | last post by:
I'm a beginner with Javascript and especially cross-browser Javascript. I got this working in IE, but not in Netscape 7. It seems like, in Netscape, every time I click on a button, the focus shifts...
1
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff...
3
by: brian.newman | last post by:
I'm having trouble with XML in IE. I wrote the following function and it works fine in Firefox, but when I try to run it in IE, I get the error "getElementsByTagName(..).0' is null or not an...
3
by: weston | last post by:
I'm making a foray into trying to create custom vertical scrollbars and sliders, and thought I had a basic idea how to do it, but seem to be having some trouble with the implementation. My...
1
by: ferraro.joseph | last post by:
Hi, I'm querying Salesforce.com via their AJAX toolkit and outputting query results into a table. Currently, their toolkit does not possess the ability to do table joins via their structured...
9
by: johnd126 | last post by:
I have a cgi program which outputs a fairly hefty amount of html/javascript for doing a complex slide show sorta thing in a variety of areas in the browser. I accomplish this by creating a series...
6
by: Just Me | last post by:
Any ideas on this. I am trying to loop through an xml document to remove attributes, but Im having so much trouble, any help is appreciated //THIS IS THE EXCEPTION ( SEE CODE LINE WHERE FAILURE...
13
by: Saint48198 | last post by:
I'm having trouble with an array of data created using the 'getElementsByTagName' call. I'm trying to remove duplicates from the Array. code follows: // creates a list of all keywords and the...
8
by: Rabel | last post by:
I am new to asp and I am having a little trouble with the Request.form option. What I want to do is I have a dropdown box. <select name="selecter" class="text" id="selecter"> <option...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.