Skip to content

Instantly share code, notes, and snippets.

@BrianEmilius
Created May 4, 2017 12:25
Show Gist options
  • Select an option

  • Save BrianEmilius/70fb473cc72414cd451d92a403fc9ece to your computer and use it in GitHub Desktop.

Select an option

Save BrianEmilius/70fb473cc72414cd451d92a403fc9ece to your computer and use it in GitHub Desktop.
<?php
require_once 'functions.php';
if (requestMethodCheck('GET')) {
$myArray = getRequestArray(INPUT_GET);
$name = $myArray['name'];
$origin = $_SERVER['HTTP_REFERER'];
$ip = $_SERVER['REMOTE_ADDR'];
$target = $myArray['target'];
$data = array('action' => 'clicktracking', 'name' => $name, 'origin' => $origin, 'ip' => $ip);
$data_string = json_encode($data);
$ch = curl_init('http://localhost/undervisning/reklamer/api.php');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
header("Location: $target");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment