Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function($searchReplace){
    // see /apps/common/components/helpers/CampaignHelper.php#L657 for more tags:
    $subscriber_uid   = $searchReplace['[SUBSCRIBER_UID]'];
    $campaign_uid     = $searchReplace['[CAMPAIGN_UID]'];
    $subscriber_email = $searchReplace['[EMAIL]'];
    // do a curl call for this subscriber to generate whatever you need.
    // put it in the $content variable and be done with it:
    $content = super_duper_function_that_makes_remote_call($subscriber_email);
    // inject the custom tag
    $searchReplace['[YOUR_CUSTOM_UNIQUE_TAG_NAME]'] = $content;
    // return new search/replace array
    return $searchReplace;
});Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function($searchReplace){
    $mask = $this->getOption('mask', '1hour');
    $amount = $this->getOption('amount', 1);
    $request = $this->tgoGiftRequest($mask, $amount);
    $searchReplace['[TGO_MAKE_GIFT]'] = $request;
    return $searchReplace;
});curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //- fix the problem.<a href="https://link.com" target="_blank" rel="noopener">https://link.com</a>Yii::app()->hooks->addFilter('campaigns_get_common_tags_search_replace', function($searchReplace){
    $mask = $this->getOption('mask', '1hour');
    $amount = $this->getOption('amount', 1);
    $wrapStart = $this->getOption('wrapStart');
    $wrapStop = $this->getOption('wrapStop', '<br />');
    $request = $this->tgoGiftRequest($mask, $amount);
    $json = json_decode($request);
    $content = '';
    if (count($json) == 1)
        $content = $wrapStart . $json[0] . $wrapStop;
    else {
        foreach ($json as $gift) {
            $content .= $wrapStart . $gift . $wrapStop;
        }
    }
    $searchReplace['[TGO_MAKE_GIFT]'] = $content;
    return $searchReplace;
});$request = $this->tgoGiftRequest($mask, $amount);
                $json = json_decode($request);
                $content = "";
                if (count($json) == 1)
                    $content = $this->checkWrap($json[0]);
                else {
                    foreach ($json as $gift) {
                        $content .= $this->checkWrap($gift) . '<br />';
                    }
                }public function checkWrap($url){
        return ($this->getOption('wrapWithA', 'no') == 'yes') 
                ? $url : CHtml::encode($url);
    }The result returned from your api ?It's just array of urls that look like this.
PHP:[ "https://test.url", "https://test.url2", "https://test.url3" ]
$urls = json_decode($this->tgoGiftRequest($mask, $amount), true);
$content = "";
foreach ($urls as $url) {
    $content .= $this->checkWrap($url) . '<br />';
}
// 
public function checkWrap($url){
    return ($this->getOption('wrapWithA', 'no') == 'yes') ? $url : CHtml::encode($url);
}