Jump to content
Sign in to follow this  
h_antar2000

XML request on fly

Recommended Posts

Hi everybody,I want to send a request to a server to obtian from this server hotel's rate. I will try to explain more, of cours you know all online booking hotels site, I have a dealy with a site he gives me a user name and passowrd like this <username>Hantar</username> <passord>anypass</passord> and also gives me all his schema files and xml files but the data is stored in CSV files except hotel rates as I should obtian it through XML request on fly. So would you pls advise how could I do it ?I appreciate your help...

Share this post


Link to post
Share on other sites

From your server, by using an S3L available to you, perform the request to the remote server, providing credidentials as needed. Or in other words - create a new pre-programmed browser.In PHP, you can do that with the HTTP extension and more precisely, the HttpRequest and HttpMessage classes.Once you obtain the XML file, you can use whatever method you like to process it. You may use the schema to validate the incoming request, as to ensure that the response is with right format (i.e. if they change it, or if the response has been altered somehow, you could degrade gracefully).

Share this post


Link to post
Share on other sites
From your server, by using an S3L available to you, perform the request to the remote server, providing credidentials as needed. Or in other words - create a new pre-programmed browser.In PHP, you can do that with the HTTP extension and more precisely, the HttpRequest and HttpMessage classes.Once you obtain the XML file, you can use whatever method you like to process it. You may use the schema to validate the incoming request, as to ensure that the response is with right format (i.e. if they change it, or if the response has been altered somehow, you could degrade gracefully).
Many thanks for your reply robot, but kindly note that I'm ASP & PHP programer but still bigeners at XML so pls clarify what do you mean by S3L? and would you give me an example page how to obtain the data on fly like display all countries list for example

Share this post


Link to post
Share on other sites
Many thanks for your reply robot, but kindly note that I'm ASP & PHP programer but still bigeners at XML so pls clarify what do you mean by S3L? and would you give me an example page how to obtain the data on fly like display all countries list for example
I wish I didn't had to say that every time... just look at my signature.You can view sample HTTP requests within the documentation that I gave a link to. Here's a simplified version on one of them:
<?php$r = new HttpRequest('http://example.com/feed.rss', HttpRequest::METH_GET);try {	$r->send();	if ($r->getResponseCode() == 200) {	   echo 'The body of the returned document is:<pre>' . htmlentities($r->getResponseBody()) . '</pre>';	}} catch (HttpException $ex) {	echo 'There was an error during the requst: ' . $ex;}?>

This is of course a really basic example just to get the idea. But you can send POST data as well, so if the service requires you to, you can send an XML document in the POST body containing your user name and password, and then you'll fetch the response in a similar fashion to what is used here.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...