|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
We want to get online data of products from supplier web site. The supplier site has sent us XML API reference to connect to there DB server and to download the latest products. Can you please let me know how can i connect to the other server with XML? what playform i needed or any guideline? How can i pass the query to other Db server from XML and catch the Db server response? How can then i save the Db server response in my local DB Many Thanks, Imran Khalid imranlink@hotmail.com |
|
#2
|
|||
|
|||
|
Go ask your supplier the questions about connecting to their service then post their responses here. They're probably running some sort of web service, in which case they may have provided a .wsdl file that you'll be able to use.
What language are you using for this? If it a web service pretty much every major language has libraries that will let you communicate with it. |
|
#3
|
|||
|
|||
|
Hi,
I have asked the supplier, and they forward me a guide_imran.pdf file. I am attaching the file with this post. You may also view the online this xml file at http://www.techbuys.com/imran/guide_imran.pdf I am not able to understand this api reference sent by the supplier. Can you please help me how to use it to send and receive the request to supplier server? Many Thanks, Imran Khalid imranlink@hotmail.com |
|
#4
|
|||
|
|||
|
Ok, there a few thing you're going to need to know. First, some basics about http post requests. Each http request is made of up of a header and a body. The format looks something like this:
Code:
POST http://url.to/server HTTP/1.1 Some-header: header value other-header: header value this=the&body=of&the=request The http response is something similar. What you're going to need to do is replace the "this=the&body=of&the=request" with some xml. The response you get back will be similar. Now, as to how you actually submit an http post request with an xml body, that's going to depend on what language you're using. Pick your language, search the forums and google, and if you still need help post a message to the forum that covers the language you're using. If you need any help formatting the xml go ahead and post to this forum. |
|
#5
|
|||
|
|||
|
Hi,
We are using PHP 4.x on Windows 2000/IIS server. Please let me know how i have to send the request/response in XML body by using PHP as server side scripting language. Many Thanks, Imran Khalid imranlink@hotmail.com |
|
#6
|
|||
|
|||
|
Best bet there is to ask in the php forum. It'll probably involve the curl functions, if you'd like to read the manual. In fact, check the manual first. I'm willing to bet there's an example of what you need somewhere in the comments.
|
|
#7
|
|||
|
|||
|
Hi,
I have worked with curl functions in PHP. We pass them URL and they sent us the response from the site in a variable etc. But in our case we are working with XML and we are not posting URL and some form data to the other server. If you look on the guide_imran.pdf above attached file on the page 14, you will see a programme written to pass the data to the server in XML. <?XML > <XML_availability_submit> <Header> <UserName>ID</UserName> ...etc My question is that how i have to do this posting to the server? Where i have to save the above page and how to run it? Is the above page is a header that we have to sent to the other server while using CURL functions? $LOGINURL = "http://www.domain.com/pagex.php; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie"); $str_page = curl_exec ($ch); curl_close ($ch); |
|
#8
|
|||
|
|||
|
I think these two lines should do it:
PHP Code:
where $params is equal the xml you want to send to the server. |
|
#9
|
|||
|
|||
|
Hi,
So you mean that i have to post the XML written page in guide_imran.pdf above attached file on the page 14 to the server in the variable $params but what shoud be the value of the URL to send this request? $LOGINURL = "http://www.domain.com; Is that will be $LOGINURL = "https://tdxml.techdata.com:443/xmlservlet; in our case or any other URL? On thing more by the property curl_setopt($ch, CURLOPT_POST,1); we set the property that we are posting HTML FROM data to the server but in our case i think we are not posting any FORM fields. If we are using CURL fucntions, this mean we can also connect to other server from typing manually URL in our browser. If Yes then what should be the URL we have to type in the browser to send request to the server? Hi, We are using PHP 4.x on Windows 2000/IIS server. Please let me know how i have to send the request/response in XML body by using PHP as server side scripting language. Many Thanks, Imran Khalid imranlink@hotmail.com |
|
#10
|
|||
|
|||
|
It looks like you have the right url. As for the post, no you're not sending form fields, you're sending xml. However, the curl module "thinks" you're sending form fields, since that's usually the only reason you would POST data to a server. In this case, though, you're POSTing xml. $params should be the xml from page 14.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > connect to other server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|