$lead['contact'], 'present' => $lead['present'], 'coupon' => $lead['coupon'], 'web' => $url, ]; $parsedUrl = parse_url($lead['ref']); $roistatVisit = 'nocookie'; if (isset($parsedUrl['query'])) { parse_str($parsedUrl['query'], $queryParams); if (isset($queryParams['utm_roistat'])) { $roistatVisit = $queryParams['utm_roistat']; } } try { $roistatData = [ 'roistat' => $roistatVisit, 'key' => '', // YzQwZDM5MjA5NzdmN2QwMGZhOWQ1MTliMGM2MzQ1YWE6Mjc5NTky 'title' => 'Колесо фортуны', 'phone' => $leadData['phone'], 'is_skip_sending' => 1, 'fields' => [ 'web' => $leadData['web'], 'present' => $leadData['present'], 'coupon' => $leadData['coupon'], ], ]; file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData)); file_put_contents('temp.log', print_r('Отправлено в RS'), FILE_APPEND); } catch (Exception $e) { file_put_contents('temp.log', print_r($e->getMessage(), true), FILE_APPEND); }