Home > Other Systems (CPVLab, iMobiTrax, P202, Track Revenue, Click, Google Analytics, etc.) > The STM Mobile Tracker

Some Error I'm Seeing With STM Mobile Tracker (25)


07-16-2013 06:39 PM #1 groomez (Veteran Member)
Some Error I'm Seeing With STM Mobile Tracker

I'm getting this when I go to a direct link rotating more than one offer with the STM Mobile tracker

Code:
Warning: Header may not contain more than a single header, new line detected. in /home/mysite/public_html/m/tracking202/redirect/tracker.php on line 452
Anyone else getting this?


07-17-2013 10:35 AM #2 caurmen (Administrator)

Hmm, that's a new one.

First thing I'd recommend trying: can you set up a test campaign for each of the offers you're running in the rotation, and see if that works OK when they're not rotating? It looks a bit like there might be a newline character in one of your URLs that's causing it to get confused.


07-17-2013 11:54 AM #3 bbrock32 (Administrator)

Hmm , just tried it on my install with both cloaking ON / OFF and it redirected correctly.

The only thing I can think of , can you try turning off error reporting for PHP ( it's done on WHM or just submit a ticket to host ).

Let me know if that solves it.


07-17-2013 01:26 PM #4 groomez (Veteran Member)

ok thanks, I'll get back to you guys


07-18-2013 04:23 PM #5 groomez (Veteran Member)

Quote Originally Posted by caurmen View Post
Hmm, that's a new one.

First thing I'd recommend trying: can you set up a test campaign for each of the offers you're running in the rotation, and see if that works OK when they're not rotating? It looks a bit like there might be a newline character in one of your URLs that's causing it to get confused.
Tried that with individual offers. Still same error reporting. I double checked to see if I had a space or any odd character before my link url and all of them are fine. Nothing out of the ordinary. Haven't turned off php error reporting yet. Would I do that per domain or is it host wide?


07-18-2013 07:11 PM #6 bbrock32 (Administrator)

Just do it system wide on WHM to be sure.


07-18-2013 09:41 PM #7 groomez (Veteran Member)

Turned it off and tested the same campaign link and still spits out that error. I haven' tchanged anything with my install or server recently. Also, I was just using the tracker for a recent campaign.

I started a new one and pulled some offers and I go to test it and BAM! Here we are


07-19-2013 01:10 AM #8 zeno (Administrator)

Caurmens right in that it is likely a newline character somewhere... To be sure, try typing in something generic like http://google.com as the offer URL just in case copy/pasting is causing some chaos.

Also, what you could do is add a urlencode() line to tracker.php to see if that fixes it and it may show you were the problem is if it is indeed somewhere in the redirect URL. Find /home/mysite/public_html/m/tracking202/redirect/tracker.php and edit it at the very end like so:

[PHP]
//To forward appended params
foreach($_GET as $key => $value){
if($key!="t202id" && $key!="t202kw" && $key!="c1" && $key!="c2" && $key!="c3" && $key!="c4" && $key!="c5" && $key!="c6" && $key!="c7" && $key!="c8" ){
$redirect_site_url .= "&$key=$value";
}
}
$redirect_site_url = urlencode($redirect_site_url);
my_log('redirecting to: '.$redirect_site_url);
header('location: '.$redirect_site_url);
[/PHP]

i.e. just add the 4th-to-last urlencode line and see if that helps - if you then use a normal campaign with subids etc you should be able to look for unexpected things in the end URL and passed values.


07-19-2013 09:52 AM #9 bbrock32 (Administrator)

Good idea Zeno , that will help debugging it.


07-19-2013 02:25 PM #10 groomez (Veteran Member)

Thanks. When I put the offer "google.com" it works fine and dandy. Even when I rotate it with "bing.com" it works. Do I add all of that code?


07-19-2013 04:53 PM #11 caurmen (Administrator)

Hmm, that sounds very like there's a problem with your existing affiliate URLs that's causing this error, in that case.

To add Zeno's code to your tracker, go into YOUR_TRACKING_DIRECTORY/tracking202/redirect/, open tracker.php and replace the last three lines, which should look like:

Code:
my_log('redirecting to: '.$redirect_site_url);
header('location: '.$redirect_site_url); 
?>
with these four lines:

Code:
$redirect_site_url = urlencode($redirect_site_url);
my_log('redirecting to: '.$redirect_site_url);
header('location: '.$redirect_site_url);  
?>
Then try your direct link URL for one of your affiliate links again.


07-19-2013 06:57 PM #12 groomez (Veteran Member)

Now none of the affiliate links work. With the bing.com and google.com example this is what I get now:

Code:
Not Found

The requested URL /tracking202/redirect/http://bing.com?&subid=432&rotateid=2&t202id=6313 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
If I test a rotating group of offers now this is what it spits out per affiliate link:
note, I've removed a= and c=

Code:
Not Found

The requested URL /tracking202/redirect/http://f5mtrack.com/?a=XXXX&c=XXXX&s1=1&s2=433&subid=433&rotateid=1&t202id=1323 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


07-19-2013 09:44 PM #13 bbrock32 (Administrator)

Sorry man , found out it's a stupid bug that happens only when you have cloaking off.

I always cloak so never got it before.

Edit file tracking202/redirect/pci.php

on line 45 comment this out, i.e change from

echo "$site_url_sql";

to

//echo "$site_url_sql";

That should fix it.


07-20-2013 06:56 AM #14 zeno (Administrator)

Lol it started trying to load the URL as a local filename? Wut. Hope bbrocks fix works for ya!


07-20-2013 01:51 PM #15 groomez (Veteran Member)

Gracias fellas!


01-29-2014 03:07 AM #16 tyku86 (Member)

Quote Originally Posted by bbrock32 View Post
Sorry man , found out it's a stupid bug that happens only when you have cloaking off.

I always cloak so never got it before.

Edit file tracking202/redirect/pci.php

on line 45 comment this out, i.e change from

echo "$site_url_sql";

to

//echo "$site_url_sql";

That should fix it.
When I go to tracking202/redirect/pci.php
Line 45 looks nothing like what you have above.

My lines 40-57 looks like this:



$cloaking_on = false;
$mysql['site_url_id'] = mysql_real_escape_string($click_row['click_redirect_site_url_id']);
$site_url_sql = "SELECT site_url_address FROM 202_site_urls WHERE site_url_id='".$mysql['site_url_id']."'";
$site_url_row = memcache_mysql_fetch_assoc($site_url_sql);
$redirect_site_url = $site_url_row['site_url_address'];
}


//set the cookie
setClickIdCookie($mysql['click_id'],$mysql['aff_campaign_id']);

//now we've updated, lets redirect
if ($cloaking_on == true) {
//if cloaked, redirect them to the cloaked site.
header ('location: '.$cloaking_site_url);
} else {
header ('location: '.$redirect_site_url);
}



Any idea what to do?


01-29-2014 04:44 PM #17 caurmen (Administrator)

@tyku86 - are you getting the same bug, and are you running with cloaking off?


01-29-2014 05:10 PM #18 tyku86 (Member)

Quote Originally Posted by caurmen View Post
@tyku86 - are you getting the same bug, and are you running with cloaking off?
Yes I am getting the same bug.

Whenever i run with cloaking off it gives me that line 452 error.

When i turn on cloaking the target URL works... But when I do a conversion test at Peerfly it doesn't register the lead. Same thing with STM tracker the lead is not registered but the click is.


01-29-2014 06:06 PM #19 bbrock32 (Administrator)

Just do a search for this on the pci.php file :

echo "$site_url_sql";

and replace with

// echo "$site_url_sql";


01-29-2014 07:09 PM #20 tyku86 (Member)

Quote Originally Posted by bbrock32 View Post
Just do a search for this on the pci.php file :

echo "$site_url_sql";

and replace with

// echo "$site_url_sql";
I dont see those lines. Please see below. TIA

<? include_once($_SERVER['DOCUMENT_ROOT'] . '/202-config/connect2.php');

$mysql['click_id_public'] = mysql_real_escape_string($_GET['pci']);

$click_sql = "
SELECT
202_clicks.click_id,
202_clicks.aff_campaign_id,
click_cloaking,
click_cloaking_site_url_id,
click_redirect_site_url_id
FROM
202_clicks
LEFT JOIN 202_clicks_record USING (click_id)
LEFT JOIN 202_clicks_site USING (click_id)
WHERE
click_id_public='".$mysql['click_id_public']."'
";
$click_row = memcache_mysql_fetch_assoc($click_sql);

$click_id = $click_row['click_id'];
$aff_campaign_id = $click_row['aff_campaign_id'];
$mysql['click_id'] = mysql_real_escape_string($click_id);
$mysql['aff_campaign_id'] = mysql_real_escape_string($aff_campaign_id);
$mysql['click_out'] = '1';

$click_sql = "UPDATE 202_clicks_record
SET click_out='".$mysql['click_out']."'
WHERE click_id='".$mysql['click_id']."'";
delay_sql($click_sql);

//see if cloaking was turned on
if ($click_row['click_cloaking'] == 1) {
$cloaking_on = true;
$mysql['site_url_id'] = mysql_real_escape_string($click_row['click_cloaking_site_url_id']);
$site_url_sql = "SELECT site_url_address FROM 202_site_urls WHERE site_url_id='".$mysql['site_url_id']."'";
$site_url_row = memcache_mysql_fetch_assoc($site_url_sql);
$cloaking_site_url = $site_url_row['site_url_address'];
} else {
$cloaking_on = false;
$mysql['site_url_id'] = mysql_real_escape_string($click_row['click_redirect_site_url_id']);
$site_url_sql = "SELECT site_url_address FROM 202_site_urls WHERE site_url_id='".$mysql['site_url_id']."'";
$site_url_row = memcache_mysql_fetch_assoc($site_url_sql);
$redirect_site_url = $site_url_row['site_url_address'];
}


//set the cookie
setClickIdCookie($mysql['click_id'],$mysql['aff_campaign_id']);

//now we've updated, lets redirect
if ($cloaking_on == true) {
//if cloaked, redirect them to the cloaked site.
header ('location: '.$cloaking_site_url);
} else {
header ('location: '.$redirect_site_url);
}


01-29-2014 07:54 PM #21 olympus_max (Member)

I just had this same problem. Funny how I was about to search for it and the most recently replied topic was my answer! My cloaking was off as well. I played around with things for a while, but I had no luck getting the redirect to work. The offer link I was pasting was working fine, and my other redirects were working great - all except for this one.

I decided to say screw it and start over from scratch. I did everything the exact same, and it magically worked! I noticed that the offer link changed. I'm not sure if I copied the wrong one originally or what, but recopying the link from the network worked. It's nice when the solutions are that easy! Have you tried starting over from scratch yet?


01-29-2014 08:17 PM #22 bbrock32 (Administrator)

@tyku86

Okay you have a recent version where the issue no longer exist.

In your case make sure the affiliate link doesn't have any spaces at the start or end.


01-29-2014 10:12 PM #23 tyku86 (Member)

Quote Originally Posted by bbrock32 View Post
@tyku86

Okay you have a recent version where the issue no longer exist.

In your case make sure the affiliate link doesn't have any spaces at the start or end.
Last night when I was racking my brain over this, I was so focused on the space at the end or between the url... Went at it again today, didnt find a space at the end but found out that there was a ENTER key hit at the end. FML

Thanks for your time and help bbrock!


01-30-2014 01:24 PM #24 bbrock32 (Administrator)

^ Yeah it's always the small things, happens to me a lot too


01-30-2014 05:58 PM #25 groomez (Veteran Member)

wow, I'm glad this thread ended up helping more people


Home > Other Systems (CPVLab, iMobiTrax, P202, Track Revenue, Click, Google Analytics, etc.) > The STM Mobile Tracker