Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $ga = 'GA1.2.1969130287.1593675284';
- $payment_id = 462;
- $amount = "12.00";
- $amount = str_replace(",",".", $amount);
- $fields = [
- 'v' => 1,
- 't' => 'transaction',
- 'tid' => 'UA-XXXXXXXXX-4',
- 'cid' => $ga,
- 'ti' => $payment_id,
- 'ta' => 'cbilling',
- 'tr' => $amount,
- 'cu' => 'RUB'
- ];
- $url = 'https://www.google-analytics.com/collect';
- $content = http_build_query($fields);
- $content = utf8_encode($content);
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-type: application/x-www-form-urlencoded'));
- curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
- curl_setopt($ch,CURLOPT_POST, TRUE);
- curl_setopt($ch,CURLOPT_POSTFIELDS, $content);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_exec($ch);
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement