a gentle nudge

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I volunteered for a church project whereby I need my PHP page to send  
off a HTTP request to third party web site that provides a service.  
That service sends back a small XML file of information.  My PHP page  
should capture that response, parse the XML, and display the information  

I spent probably hours looking through the function list and still have  
not determined which package does what I need.  There's the http package  
that seems like is what I need for my page to send out the request, but  
there are no examples and very little documentation on using these tools  
(on php.net)...

Then, how do I capture the data stream sent back from that remote  
website?  Is that part of the http package, too, or do I need something  

I'm confident I can use domxml_xmltree() to parse the string I get back  
into something more useable...

I probably don't need a dissertation on how to do it, but just a gentle  
nudge to point me to the basic packages I need to dig into more deeply.  
  But if you want to send a dissertation, I'd be delighted at what I  
could learn!


Re: a gentle nudge

sometimes it's called page scrubbing (or it's at least related to it),
search for that and php and you might get somewhere.

Another source is the Book PHP Hacks which discusses it.

I haven't tried it yet so that's all I can offer.


Re: a gentle nudge

Your Name wrote:
Quoted text here. Click to load it

Can you provide some info about what you want to do in terms of user
interface? Do you want to execute the call and parse the returned
content when a user clicks something, or do you want to run this
periodically as a system process?

The first would be an example like returning a weather forecast when a
user enters a zipcode, and would best be implemented using something
like an AJAX request that is launched by a user. You could send the
request directly to the other site, and then process the response.

The second might be something like grabbing the days postings from a
forum, which would be saved locally once per night. This would likely
use a cron entry to fire off a php page that could handle data returned
from the target website through the use of CURL,

Re: a gentle nudge

pangea33 wrote:
Quoted text here. Click to load it

Use cURL:

Quoted text here. Click to load it

Well, as you indeed state later one of the several XML packages. DOM, DOM
XML, XML, all possibilities. It depends what's possible on the server and
what suits your needs.

Quoted text here. Click to load it

cURL is all that is needed to get the information. When in doubt, try to
inspect the headers sent to and from a site when trying to get the XML
manually, and mimique this in cURL.

For parsing the returned XML you have loads of options, even 'by hand' if
it's a very small file.

Rik Wasmus

Re: a gentle nudge

Not sure but the response fro the other website may be SOAP so these
functions may help you out: http://au3.php.net/soap

Site Timeline