- Inserting data from one server to another running PHP. | Blog

Blog Section

Inserting data from one server to another running PHP.

on .

There is a simple way to accomplish the above mentioned process i.e, webservices. The logic behind a web service is  very simple. A web service could be implemented by the exchange of data between a server and a client, using SOAP, XML or JSON.

First of all, implement a web-service on the database side and then on the client side and both require authentication.A login username and password is require for accomplishing this. The popular example of a web service is RSS feed. All the data exchange is handled through the standard HTTP Protocol using port 80 and the data is gotten from the server either in the form of XML or JSON.  Below, i am giving a brief introduction to the web service technologies.

 SOAP    (Simple Object Access Protocol).

  SOAP is a plateform independent lightweight protocol for exchange of information. SOAP is also a w3c recommendation.  SOAP is basically an XML document which is comprised on mainly three elements, an envelope, which checks the document that it is an XML document or not. A header element and the body, which actually contains the call and response information.

A SOAP request:

 POST /InStock HTTP/1.1
 Host: www.yoursite.com
 Content-Type: application/soap+xml; charset=utf-8   
  //  i recommend to specify the characterset encoding becuase windows based servers could also return sometime cp1252 encoding instead of   utf-8
 Content-Length: 111  //  length of the content

 <?xml version="1.0"?>
 <soap:Envelope xmlns:soap="http://www.mysite.com/soap_env" soap:encodingStyle="http://www.mysite.com/soap_enc">  
 <soap:Body xmlns:m="http://www.yoursite.com/student?soap">  

The SOAP response:

 HTTP/1.1 200 OK
 Content-Type: application/soap+xml; charset=utf-8
 Content-Length: 111

 <?xml version="1.0"?>
 <soap:Body xmlns:m="http://www.yoursite.com/student?soap">

The above process can be made more secure by implementing authentication on server side and using curl at client side to connect.

Plz share this on

Submit to DeliciousSubmit to DiggSubmit to FacebookSubmit to Google PlusSubmit to StumbleuponSubmit to TechnoratiSubmit to TwitterSubmit to LinkedIn


Services Pricing

Services Pricing

Request a Free Quote

Email an Enquiry