Post back an IMG pixel not working!

brentb

(__TNT__)~
Jun 13, 2011
281
4
0
I need to write a postback script that will run when executed by an affiliate network.

I am assuming its executed by cURL (isn't that the standard way for an aff network to send postback?).

Can I just do this?:

Code:
POSTBACK LINK ENTERED INTO AFF NETWORK: http://domain.com/1/postback/?transaction_id=[SID]&status=[STS]



http://domain.com/1/postback.php <= This is the code below.

Code:
<?php

$transaction_id = $_GET['transaction_id'];
$status = $_GET['status'];

//CONNECT TO DATABASE
$username="username";
$password="password";
$database="database";
$con = mysql_connect("localhost",$username,$password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($database) or die( "Unable to select database");

//UPDATE SUCCESS status 1 is payable 2 is denied
if ($status == 1) {
mysql_query("Update offer1 SET success = '$status' WHERE transaction_id = '$transaction_id'");

//OTHER COMPANY PIXEL
echo <<<EOD
<!-- Offer Conversion -->
<img src="http://othercompanydomain.com/aff?offer_id=xxxxx&transaction_id=<?php echo $transaction_id; ?>" width="1" height="1" />
<!-- // End Conversion -->
EOD;

mysql_close($con);

}
else {
}

?>

The postback isn't registering into my traffic source pixel, nor writing to my database.
 


in the else{} at the bottom, echo the $status and see if it prints anything
 
You have "/postback/" instead of "postback.php" in the URL.

You also have <?php ... ?> tags within each other. Remove those from the "Other Company Pixel" section.
 
in the else{} at the bottom, echo the $status and see if it prints anything

Just tried, nothing echoed.

You have "/postback/" instead of "postback.php" in the URL.

Typo on here, it should be domain.com/1/postback/index.php is the file with this code. Good catch though.

You also have <?php ... ?> tags within each other. Remove those from the "Other Company Pixel" section.

Awesome call! Missed that because of EOD, just started using that instead of echo for code snippets. I think this was the problem.

I also am now thinking write to database didn't work due to unrelated issue.

Can't retest yet due to IP block but will update when I do. Thanks guys!