0

下面是我的任务。

我有一个在 codeigniter 中开发的应用程序,该应用程序总是通过 Web 服务从客户那里获取数据。在大多数情况下,数据 (xml) 的大小会很大。这是我卡住的地方。如何通过 Web 服务将这些潜在客户数据发送到服务器。我计划使用 REST Web 服务来实现它

一种选择是读取 xml 数据并将内容作为参数与请求一起发送。喜欢...

$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));

但是在大文件的情况下,我认为它不会正常工作..

另一种选择是这样的......

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;
}

是否有可能实现这样的事情。这里我们不需要将内容作为参数发送。

4

1 回答 1

0

也许您应该每 5(?)分钟在服务器上使用 cron 一次?在客户端,您将发送最后解析的数据。 cron

于 2012-11-28T05:20:53.350 回答