Woah..CPV question...Can you solve this one ?

mlektra

Banned
Jan 8, 2008
57
1
0
Canada
Hi guys. I am doing dynamic keyword instertion with PPV traffic.

This is the link that trigger the landing page view on the network I am using. In that case it's AdOn Network.

http://www.mydomain/rotator/?kw={SEARCHTEXT}{PARTNERID}

For the sake of simplicity I will only say that I use the { } characters for better understanding in my prosper202 stats.
So when I check my stats, I see the keyword like this : {mydomain.com}{18857}

The number is the ID of the "partner" that dispatch my traffic. AdOn is using several partner to distribute their traffic. So it help me to know which keyword URL/partner have made the conversion.

Ok. But the real question is that I am using dynamic keyword insertion in my landing page with the <? echo $keyword; ?> string. I am inserting the keyword somewhere in the page mostly in that format :

"Hey you {mydomain.com}{18857} visitor...."

but I would need something more like :

"Hey you mydomain.com visitor...."

Since I need the string contain the data that way {mydomain.com}{18857} is there a way in php or javascript to remove the { } signs + the {PARTNERID} variable? Is there a way to modify the <? echo $keyword; ?> string to do what I need ?

Yeah..I'm looking for you, php god !:1zhelp:
 


just a guess

$newkeyword = str_replace("{[0-9]+}","",$keyword);
$newkeyword = str_replace("{","",$keyword);
$newkeyword = str_replace("}","",$keyword);
echo $newkeyword;
 
PHP:
$kw = '{mydomain.com}{18857}';

preg_match("/\{(.*)\}\{/", $kw, $matches);
echo $matches[1];
 
PHP:
$kw = '{mydomain.com}{18857}';

preg_match("/\{(.*)\}\{/", $kw, $matches);
echo $matches[1];

I read a little about preg_match and if it can help, I can change the output of the values and make them look like :

{ebay.com}[1116]

So we could start and find a way to hide whatever inside the [ ] character.

So we're left with the {ebay}.

Deliguy has a start of an answer with his idea. But it seems that only the last string was working.

I'm skimming php sites since i am really noob in php. I dont see something useful.
 
The code I put in my last post does what you asked for, no? It works when I run it here.
Yeah it's working. But you have to be sure to refer to the right value.

So :

$keyword = $_GET['t202kw'];

and it will work fine.

Thanks

I have also that code that do the work well too :

$newkeyword = explode("}{",$keyword);
$newkeyword = str_replace('{',"",$newkeyword[0]);
echo $newkeyword;

it's a variation of the code provided by Deliguy (thanks man!)


Also, if you guys want to move it to the next level, I have harder stuff for you.

if in the {SEARCHTEXT} i have a long URL I am bidding on like :

www.wickedfire.com/newreply.php?do=postreply

it will mostly screw my landing page look :

text_screwed.gif



Is there a way to shorten any long URL that I am bidding on to is simplest expression and show to the user only the root domain, like : www.wickedfire.com instead of www.wickedfire.com/newreply.php?do=postreply ?

Thanks for the help guys!

 
There is a function called parse_url that will split up a URL into its parts, then you just need to grab the 'host' part of it, which will be the domain name.
 
PHP:
<?php
function getHost($Address) {
   $parseUrl = parse_url(trim($Address));
   return trim($parseUrl[host] ? $parseUrl[host] : array_shift(explode('/', $parseUrl[path], 2)));
} 

print getHost($_SERVER['HTTP_REFERER']);
?>
 
What about this?

PHP:
$newkeyword = explode("}{",$keyword);
   $newkeyword = str_replace('{',"",$newkeyword[0]);
   if(strstr($newkeyword,"/")) {
     $aTemp=explode("/",$newkeyword);
     $newkeyword=$aTemp[0]!="" ? $aTemp[0] : $newkeyword;