Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getIp()
- {
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
- $ip = $_SERVER['HTTP_CLIENT_IP'];
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
- } else {
- $ip = $_SERVER['REMOTE_ADDR'];
- }
- return $ip;
- }
- function apiWebvorkV1NewLead($post, $ip, $offerId, $counter = 0)
- {
- $token = '7d4c0905ee1b207f05a83d3846c5fc05'; // Заменяем на свой из кабинета
- $url = 'http://api.webvork.com/v1/new-lead?token=' . rawurlencode($token)
- . '&ip=' . rawurlencode($ip)
- . '&offer_id=' . rawurlencode($offerId)
- . '&name=' . rawurlencode($post['name'])
- . '&phone=' . rawurlencode($post['phone'])
- . '&country=' . rawurlencode($post['country']);
- $json = file_get_contents($url);
- $data = json_decode($json, 1);
- if ($data['status'] != 'ok') {
- if ($counter < 5) {
- sleep(1);
- return apiWebvorkV1NewLead($post, $ip, $offerId, ++$counter);
- } else {
- return false;
- }
- }
- if ($data['status'] == 'ok') {
- return true;
- }
- }
- apiWebvorkV1NewLead($_POST, getIp(), 1);
- header("Location: https://slimbody.website/success.php?fb_pixel=".$_POST['fb_pixel']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement