Forum Moderators: coopster
How would I open this random url automatically? Meaning, once the code produces the link I need to auto open this url.
Meta refresh requires a url and all I have is some php code that has to be loaded in a browser before a url is produced.
I don't think php can be used inside of an htaccess file.
OR look at it this way, if you have a page with one text link on it but you don't know what the url will be before loading the page, how would auto open whatever url is displayed. A script to add the url to a meta refresh or something?
What about creating a seperate page that meta refreshes to whatever url is on the php code page.
Like,
this will have the random url
http://www.example.com/phpcode.php
and this is where traffic will be sent and will use the meta refresh
http://www.example.com/refresh.php
On refresh.php we'll grab the "banner id" which is what will change in the url's on phpcode.php
So we'd use as the meta refresh on refresh.php
http://www.example.com/script.php?bannerid= <?php echo $number;?> http://www.example.com/script.php?bannerid= ' . $number. ' But I can't figure out how to grab the random banner id from phpcode.php. How would that work?
[edited by: dreamcatcher at 6:29 pm (utc) on Aug. 3, 2007]
[edit reason] Use example.com, thanks. [/edit]
So long as you don't have any screen output in phpcode.php, then you just need to do this whenever you're done getting your random number:
header("Location: http://www.example.com/script.php?bannerid=$number");
That line will tell the browser to scuttle off to the supplied location provided you haven't already defined any header information (such as writing html output).
If you still want to persue the meta refresh idea, you'll need to send the bannerid number to each page in the chain via GET.
[edited by: dreamcatcher at 6:29 pm (utc) on Aug. 3, 2007]
[edit reason] Use example.com, thanks. [/edit]
This is the original php that is on the page before being parsed.
<?php
if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:23', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?> The text link is generated in the browser and displayed on phpcode.php, the url looks like this,
http://www.example.com/script-link.php?bannerid=2010&zoneid=23&source=& dest=http%3A%2F%2Fwww.theirdomain.com
And the actual html source of the page looks like
<a href='http://www.example.com/script-link.php?bannerid=2010&zoneid=23& source=&dest=http%3A%2F%2Fwww.their-domain.com' target='_blank'>Text Link</a><div id="beacon_2010" style="position: absolute; left: 0px; top: 0px; visibility: hidden;">
<img src='http://www.example.com/script-log.php?bannerid=2010&clientid=3055& zoneid=23&source=&block=0&capping=0&cb=cookie-here' width='0' height='0' alt='' style='width: 0px; height: 0px;'></div> This is phpAdsNew that I'm working with in case you were wondering.
Only the "bannerid" number is what I need to add to...
header("Location: http://www.example.com/script-link.php?bannerid=' . $number. '&zoneid=23")
The zone will stay the same and "&source=&dest=their-domain.com" isn't a necessity.
[edited by: Doood at 7:18 pm (utc) on Aug. 3, 2007]
[edited by: dreamcatcher at 6:30 am (utc) on Aug. 4, 2007]
[edit reason] Use example.com, thanks. Fixed side scroll. [/edit]
You want to give another site a link to this php page you're making so that they put that link on one of their images. You then want to make it such that when a user clicks on that image, they're taken to this script on your site and then automatically forwarded to wherever advertiser phpAdsNew would have sent them to, had they actually clicked again on the page you're script is set up on. Correct?
The problem then, is that phpAdsNew generates a link randomly from its own includes file and, because of this, the bannerid is only known at runtime. Since this is the case, there's no way for you to know what the bannerid will be until the page is generated. So, you need a way to find the bannerid after phpAdsNew has randomly picked it but before the ad is displayed. Then you can use that bannerid to make your own auto-forward script on to the advertiser's site.
I'm sure you have your reasons for this, though I'm not sure what that would be. You might be able to dig into the phpAdsNew included file there and see if there's a bannerid variable you could pull from somewhere. That's where it would be. Since phpAdsNew does it's own thing, you also probably wouldn't be able to use the header redirection I mentioned before, unless you modify the phpAdsNew code to set the header info before it displays the ad.
Since the page is made dynamically and the bannerid isn't 'stored' anywhere other than a varaible in the phpAdsNew programming, I don't know that there would be another way to do it. You might be able to force a click on the ad with some fancy JavaScript, but that borders on... well, not very nice.
[edited by: Duskrider at 7:55 pm (utc) on Aug. 3, 2007]
I've been a traffic broker for almost 5 years now and use PAN to display about 60 million ads per day. This is my fulltime job. I use PAN kind of like adsense, lots of external sites iframe a page on my site with ad links in it. They're free sites like blogs and stuff, no products or paysites or scams.
It's just that now a friend with very high quality traffic want to send it thru my system from image links on his site.
I can create a random link on my site easily but not on an external site using a fast delivery method.
All I'm looking for is a url he can use to send traffic to random active campaigns. I think I did something similar once years ago but can't figure it out now.
[edited by: Doood at 8:08 pm (utc) on Aug. 3, 2007]
So if a script was used on the page where the banner is which looked for the code with the banner to find the banner id it could possibly work somehow.
Seems way too difficult though and is probably more trouble than what it's worth.
Used a little,
preg_grep
substr
htmlspecialchars_decode
and the header location that was mentioned here. Also learned and tried about 50 other php functions that didn't work, good to know though.
Thanks for the help.