Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Page URL

Status
Not open for further replies.

WebStuck

Programmer
Apr 12, 2003
79
US
Hi,

I am running OpenAds (formerly phpAdsNew) on one domain to display ads on another domain. My problem is that my 'banner code' in OpenAds uses php code that attempts to get the URL from the page where the ad is displayed. However, it keeps trying to grab the URL from the .php file that the OpenAds javascript calls to display the ad. Is there a way to get the page URL from the page the ad is displayed on and not the URL of the ad program?

Thanks!
Ben
 
i assume the banners are displayed in iframes etc? if so you will need to change the openads js to send the relevant info. probably more of a js question than php.

if not an iframe then the page name should be either available in the environment variables or the $_SERVER superglobal.
 
The ads aren't displayed in an iframe. Let me try to give an example of the problem I am having. I have the OpenAds javascript code on The javascript code calls which calls my ad code that contains php code that has $current_url = $_SERVER['PHP_SELF'];. Unfortunately $current_url = ads.php and no index.html. Hope this helps to explain the problem.

Thanks!
Ben
 
thoughts:
is the HTTP_REFERER populated?
could you not add some information to the query string of the url calling ads.php?
 
I actually got it working last night by adding some information to the query string of the url calling ads.php.

Thanks!
Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top