簡體   English   中英

Joomla注冊新用戶-通過cUrl發送數據

[英]Joomla register new user - send data by cUrl

我有這個:

$url = "http://xxxxxxxx";

$data = array (
userId                          =>      xxx, // authentication userId
loginToken                      =>      'xxxxxx', // authentication loginToken
'customerType'                  =>      'Person',
'firstName'                     =>      'Lukasz',
'lastName'                      =>      'Testowy',
'emails[0].email'               =>      'email@exaple.com',
'phones[0].phoneNumber'         =>      '0123456789',
'documentNo'                    =>      'ABC1234567',
'address.city'                  =>      'Warsaw',
'address.postalCode'            =>      '01-001',
'address.street'                =>      'Sobieskiego',
'note'                          =>      'some info'
);

$data_string = http_build_query($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch); 

當我將其另存為test.php並運行時,效果很好。 它將所有數據發送到$ url。

我需要將其連接到Joomla3.x。 當新用戶注冊時,此腳本應將其數據(例如名字,姓氏等)放入“ Lukas”,“ Testowy”等中並將其發送到$ url。 怎么做?

好的,我們開始:

之后在com_users / controllers / registration.php中添加了我的代碼

} elseif ($return === 'useractivate')
        {
            $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
            $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));

而且有效! 用戶注冊后,它將通過cUrl發送樣本數據。 所以問題是:如何替換正在注冊的用戶數據上的測試數據-Lukasz,Testowy,email @ example.com等?

暫無
暫無

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

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