简体   繁体   中英

PHP web service, sending xml data in large size

Bellow given is my task.

I have a an application developed in codeigniter,the application always getting data from their customers through web service. In most cases the data (xml) will be large in size. Here is where I got stuck. How do I can send these lead data to the server through web service. I planned to implement it using REST web service

One option is read the xml data and send the content as parameter along with the request. Like...

$xmlfile = "leads.xml";
$xmlRaw = file_get_contents($xmlfile);

include 'RestClient.class.php';

$url = "http://localhost/apps/index/";
$ex = RestClient::post($url,array('requestType' =>'sendLead',
                                                        'username' => $name,
                                                         'pass' =>$pass,
                                                         'leadXML'=>$xmlRaw));

But in the case of large file, I dont think it would work fine..

Another option is something like this...

Client side                                                                          server
------------------                                                                  --------------------

// send a request to the server with xml file name             

rest::sendLeads("leads.xml"){                                  |    sendLeads(){
                                                               |
                                                               |     $filename =$this->post('filename');
}                                                              |  // calling a client side function and collecting the xml data
                                                               | $xmldata =  getdata($filename);
                                                               |        }
getdata(filename){                                             |

reading xml content and send back it to the server

return $xmldata;
}

Is it possible to implement something like this. here we dont need to send the content as parameters.

Maybe you should to use cron on the server every 5(?) minutes? On the client side you will send last parsed data. cron

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM