0

how to make affiliate tracking conversions with postbackurl ? postback URL that I make like this that I post on the main affiliated network

http://funto.xyz/ajax.php?uid=29&oid=45&offerid=4069&sub_id=#s2#

And I am trying to get a response like this but no response get please help how to track conversion from

if(isset($_GET['uid']) && isset($_GET['oid']) && isset($_GET['offerid']) && isset($_GET['sub_id'])){
    $uid = $_GET['uid'];
    $oid = $_GET['oid'];
    $offerid = $_GET['offerid'];
    $s2 = $_GET['sub_id'];
    //$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
    //$myurl= 'http://' . $_SERVER['HTTP_HOST'] . $uri_parts[0].'?s1='.$sub_id.'&uid='.$uid.'&oid='.$oid;
    $reffer = $_SERVER["HTTP_REFERER"];
    $ip = $_SERVER['REMOTE_ADDR'];
    $subid = time();
    setcookie($s2, $s2, time() + (86400 * 30), "/");
    $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
    $ip = $details->ip;
    $country = $details->country;
    $datetime = date('Y-m-d H:i:s');
    $date = date('Y-m-d');
    $query="INSERT INTO clicks (uid,oid,offerid,subid,clicks,signup,reffer_link,ip,country,proxy, date,datetime) VALUES ('$uid','$oid','$offerid','$subid','1','$s2','$reffer','$ip','$country','proxy', '$date','$datetime')";
    $result = mysqli_query($con,$query)  or die("Error: ".mysqli_error($con));

    if ($result == 1){
        $qry = "select offername from offers where oid = '$oid'";
        $run = mysqli_query($con, $qry) or die(mysqli_error($con));
        $res = mysqli_fetch_array($run);
        $link = $res['offername'].$subid;
        //$myurl= 'http://' . $_SERVER['HTTP_HOST'] . $uri_parts[0].'?s1='.$sub_id
         //header ("Loca`enter code here`tion: $myurl");
        header ("Location: $link");

        }

}
  • 1
    You are wide open to [SQL Injections](http://php.net/manual/en/security.database.sql-injection.php) and should really use [Prepared Statements](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) instead of concatenating your queries. Specially since you're not escaping the user inputs at all! – M. Eriksson Jul 04 '17 at 05:46
  • 1
    You need to clarify your question and explain your issue. What is the code suppose to do and what are you currently getting? – M. Eriksson Jul 04 '17 at 05:48
  • plz you just guide me how the postback url work and how to get response from it ? – Shahid Ashraf Jul 04 '17 at 06:06
  • If you can't explain what your issue is or what the expected result should be, we have _no chance_ to even _start_ to understand. – M. Eriksson Jul 04 '17 at 06:10
  • issue is to how to get response from postback url and save it in to db – Shahid Ashraf Jul 04 '17 at 08:10
  • You have a bunch of code. What happens when you run your code? Where is the actual problem? And **_what response_** are you trying to get? This question **is still unclear**. You **MUST** add detailed information about what it is your trying to do, example of what you expect it to produce and example of what you're actually getting. **We don't know** what the expected response is, what result of the above code is. We are _not_ mind readers. Keep repeating the same thing over and over does _not_ clarify the question. – M. Eriksson Jul 04 '17 at 08:14

0 Answers0