簡體   English   中英

將數據發布到同一站點上的另一個Joomla頁面

[英]POST data to another Joomla page on the same site

我有一個Joomla控制器,可以對某些Google Checkout XML代碼進行多次迭代。 我想要的是在此迭代過程中,將數據POST到同一站點中的另一個頁面。

所以

com_mycomponent/controllers/checkout_iterator.php //breaks up the xml into small parts and posts then to the executor, one at a time
com_mycomponent/controllers/checkout_executor.php //does the real work for each XML element it is passed

iterator.php控制器會將數據發布到executor.php可能有2次甚至50次。

我怎樣才能做到這一點?

要將數據發布到php中的頁面,可以使用cURL擴展名

一種快速而骯臟的方式可能是這樣的。

$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'com_mycomponent/controllers/checkout_executor.php');
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_POST, true);

// send data
curl_setopt($c, CURLOPT_POSTFIELDS, 'a=1&b=2..');
curl_exec($c);
// other data.. we can use same handle
curl_setopt($c, CURLOPT_POSTFIELDS, 'a=1&b=2..');
curl_exec($c);

// don't forget to close
curl_close($c);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM