11th of November 2020 - CPAElites is for sale! As a result of the 4th CEO absence in 2020 (for months): Please click [here] to read more!


OfferToro Postback Help
2016-12-30, 03:28 PM,
#1
Hi, I'm currently setting up an OfferToro offer wall and testing the postback on their website works perfectly fine, however when a user actually completes an offer it gets sent 5 times.

Their guide states:

"We expect a "1" (without quotes) as a response to a successfull received postback and a "0" (without quotes) to indicate that the postback was not received correctly. We will try to send the postback up to 5 times if not receiving a "1" as a reply. After that we will send you an email with the data of the conversion so you can process it manually."

So clearly I am not responding with a 1, as the postback is getting sent 5 times resulting in my offer wall rewarding 5x the points it should. I'm a bit of a newbie with php and so any help on how to respond with a 1 would be greatly appreciated.

I have contacted support but they were of no help whatsoever telling me just to figure it out myself.
Reply
2016-12-30, 08:18 PM,
#2
Well can you post the code?
Reply
2016-12-31, 03:24 PM,
#3
(2016-12-30, 08:18 PM)CegaFin Wrote: Well can you post the code?

Code:
<?php

session_start();

$servername = "localhost";
$dbusername = "";
$dbpassword = "";
$dbname = "";

// Create connection
$conn = new mysqli($servername, $dbusername, $dbpassword, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

mysqli_query($conn, "SET NAMES utf8");

include_once("../../functions.php");


        // get variables and prevent against SQL injections
$campaign_id = mysqli_real_escape_string($conn, $_GET['campaign_id']);            // Campaign ID
$campaign_name = mysqli_real_escape_string($conn, $_GET['campaign_name']);        // Campaign Name        
$subid = mysqli_real_escape_string($conn, $_GET['sid']);                         // Primary SubID
$subid2 = mysqli_real_escape_string($conn, $_GET['sid2']);                      // Secondary SubID2
$subid3 = mysqli_real_escape_string($conn, $_GET['sid3']);                      // Secondary SubID3
$commission = mysqli_real_escape_string($conn, $_GET['commission']);            // Commission        
$status = mysqli_real_escape_string($conn, $_GET['status']);                      // Status: 1 (Credited) or 2 (Reversed)
$ip = mysqli_real_escape_string($conn, $_GET['ip']);                              // User IP Address
$reversal_reason = mysqli_real_escape_string($conn, $_GET['reversal_reason']);  // Reversal Reason (usually not sent)
$vc_value = mysqli_real_escape_string($conn, $_GET['vc_value']);                  // Virtual Currency Only - VC Ratio * Commission    
$sig = mysqli_real_escape_string($conn, $_GET['sig']);                  // sig    

if ($sig == md5($campaign_id . "-" . $subid . "-" . "")) {

    
    
    
$query = mysqli_query($conn, "SELECT u.* FROM users u WHERE u.username='{$subid}'");
$u = mysqli_fetch_array($query, MYSQLI_ASSOC);
    
$text = $campaign_name;
$type = "Offer";
$provider = "Offer Toro";
mysqli_query($conn, "INSERT INTO `activity_history`(user_id, history_type, history_provider, history_text, history_points, history_date, history_fee) VALUES('{$u['user_id']}', '{$type}', '{$provider}', '{$text}', '{$vc_value}', NOW(), '0.00')");

mysqli_query($conn, "UPDATE `users` SET `points`=`points`+'".$vc_value."', `earnings`=`earnings`+'".$vc_value."' WHERE `user_id`='{$u['user_id']}'");
if ($u['referral']) {
    mysqli_query($conn, "UPDATE `users` SET `points`=`points`+'".($vc_value/10)."' WHERE `user_id`='{$u['referral']}'");
}

http_response_code(1);


}


?>

The http_response_code(1) is something I tried after it didn't work and I still have the same problem, even though the postback test is saying everything is fine. When I get a real lead it says it fails but the postback goes through 5 times.
Reply
2016-12-31, 07:39 PM, (This post was last modified: 2016-12-31, 07:44 PM by CegaFin.)
#4
I dont see any errors in the code.
By what you are saying it seems that you are not receiving the correct status or maybe not even checking for it.

Maybe im not understanding how this code works.
Where is the part of the code where you check the status variable?

On receiving status do a print to check rather it is 1 or 0.
Reply
2017-01-01, 04:59 PM,
#5
(2016-12-31, 07:39 PM)CegaFin Wrote: I dont see any errors in the code.
By what you are saying it seems that you are not receiving the correct status or maybe not even checking for it.

Maybe im not understanding how this code works.
Where is the part of the code where you check the status variable?

On receiving status do a print to check rather it is 1 or 0.

The code runs fine as the postback goes through, it's just that I'm not responding with a 1 as they requested.

The status variable isn't actually used for this postback, I check that it is valid by using the sig variable (I have removed my 'secret key' from the code). So if the sig variable is correct then a 1 should be returned, however I'm not sure how to do that.

I know the rest of it is working as users get credited with points when they complete an offer, it just gets sent 5 times as I am not responding with a 1.
Reply
2020-04-06, 04:55 PM,
#6
(2017-01-01, 04:59 PM)Socialhits Wrote:
(2016-12-31, 07:39 PM)CegaFin Wrote: I dont see any errors in the code.
By what you are saying it seems that you are not receiving the correct status or maybe not even checking for it.

Maybe im not understanding how this code works.
Where is the part of the code where you check the status variable?

On receiving status do a print to check rather it is 1 or 0.

The code runs fine as the postback goes through, it's just that I'm not responding with a 1 as they requested.

The status variable isn't actually used for this postback, I check that it is valid by using the sig variable (I have removed my 'secret key' from the code). So if the sig variable is correct then a 1 should be returned, however I'm not sure how to do that.

I know the rest of it is working as users get credited with points when they complete an offer, it just gets sent 5 times as I am not responding with a 1.

i'm late i know but what do you have in you're function.php?
Reply


Related Threads
Thread Author Replies Views Last Post
  OGAds offer API output help please AbdouMotDz 3 3,143 2020-04-24, 01:52 AM
Last Post: WORLD_PEACE
  [Help] Angular Niki 0 404 2019-05-18, 10:46 PM
Last Post: Niki
  Need Few Instructions That Can Help me Create Video Whiteboard Animation EvaHarrison 1 789 2018-08-17, 02:23 PM
Last Post: CharlieHarper
  help with embed adult videos to my site adlof 1 795 2018-02-16, 06:52 PM
Last Post: Enabled
  Need help is possible? shikoattia 1 931 2018-01-28, 11:55 AM
Last Post: CharlieHarper





About Us | Contact Us | CPAElites | Advertise | Stats

Copyright © 2013 - 2020 by (company to be announced later)
Temporarily (!) powered by MyBB, fixed (repaired) and enhanced by Charlie Harper (GitHub) aka Charles Francis Harper (Wikipedia)
Return to top
This forum uses Lukasz Tkacz MyBB addons.