Answer the question
In order to leave comments, you need to log in
How to make Bitrix url request?
Hello!
Tell me how to execute a URL request after registering a user in 1C-Bitrix?
Tried like this:
AddEventHandler("main", "OnAfterUserRegister", Array("Unisender", "OnAfterUserRegisterHandler"));
class Unisender
{
function OnAfterUserRegisterHandler(&$arFields)
{
$unisender = file_get_contents('https://api.unisender.com/ru/api/subscribe?format=json&api_key=6o5qtwwi5tgtgr4jw97xc8ypocjbq8fz3u3e48ra&list_ids=20662459,14498425&fields[email]='.$arFields["EMAIL"].'&fields[Name]='.$arFields["NAME"].'');
return $unisender;
}
}
$ch = curl_init('https://api.unisender.com/ru/api/subscribe?format=json&api_key=6o5qtwwi5tgtgr4jw97xc8ypocjbq8fz3u3e48ra&list_ids=20662459,14498425&fields[email]='.$arFields["EMAIL"].'&fields[Name]='.$arFields["NAME"].'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
$arFields["EMAIL"] = '[email protected]';
$arFields["NAME"] = 'test1';
$info = file_get_contents('https://api.unisender.com/ru/api/subscribe?format=json&api_key=6o5qtwwi5tgtgr4jw97xc8ypocjbq8fz3u3e48ra&list_ids=20662459,14498425&fields[email]='.$arFields["EMAIL"].'&fields[Name]='.$arFields["NAME"].'');
//$info = json_decode($info, true);
print_r($info);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question