I have many domains on which I use the coop code, most are PHP pages.. is there a way to have the ad_network.php and ad_network_ads file reside on a single domain, but be used by many domains? I have tried the various Perl Wrappers etc.. and have read through every message I could find on the subject and am still not having any luck..
It's technically possible, although would require some minor modifications to the file to pass user agent and IP address from the requesting server, otherwise it will just see the user agent and IP address as the server making the request to the one file via HTTP.
The Techincal part, that's where it gets me what to change and how to call it.. I've tried some tweaks based on things I've read and am coming up empty..
Ultimately you are going to need your central script to see the $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_USER_AGENT'] of the end-user (as it is now it would seem as the server making the HTTP request).
Shawn assuming I can get this to work, how would I make the call on the pages themselves.. since you can use a URL in an include, that's when I have tried the perl wrappers etc.. would the wrapper's work if the changes were made in your previous post? The change you referenced.. what specific file would that change need to occur ?
One of the methods I've been trying, and I think I have already used the code you suggested is to make an SSI call on the PHP pages to a file called coop_wrapper that is hosted on each domain ### start updated perl code sub ShowAds{ #!/usr/bin/perl # $Id: coop_wrapper.cgi,v 1.3 2005/05/02 18:19:02 cvs Exp $ # $Revision: 1.3 $ use strict; use LWP::UserAgent; # set the full http path to the page here: my $ad_url = qq{http://domain.com/coop375.php}; $ad_url .= qq{?ip=} . $ENV{REMOTE_ADDR}; $ad_url .= qq{&agent=} . $ENV{HTTP_USER_AGENT}; my $output = ''; $output .= qq{Content-type: text/html\n\n} if($ENV{GATEWAY_INTERFACE} =~ /CGI/); my $ua = new LWP::UserAgent; $ua->agent("Perl-Php-Coop-Wrapper/1.2"); my $req = HTTP::Request->new(GET => $ad_url); my $res = $ua->request($req); if($res->is_success) { $output .= $res->content; } # uncomment this line if you are seeing Content-type: text/html in your page $output =~ s/Content-type: text\/html//; print "<br/><div align=center>"; print $output; print "</div>"; } ### end updated perl code Code (perl): I then have the coop_375 file residing on a central domain ### start coop.php <?php $_SERVER['REMOTE_ADDR'] = $_GET['ip']; $_SERVER['HTTP_USER_AGENT'] = $_GET['agent']; include ('ad_network_375.php'); echo $ad_network; ?> ### end coop.php $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_USER_AGENT'] PHP: but it does not validate I've got sdome old code on a lot of sites and this is a nightmare to update. so when I do it I would love to be able to only have to change the file on one server and not the code on each page on every domain.
Did you confirm the script is seeing the end user IP/user agent? Try echoing it out or something within the ad_network PHP file to verify.
Shawn let me go with another approach here.. all my pages are PHP I have the index file in the root and many subdirectories on each page I've posted this code to call a footer file, itseems using this path is the only way to get the ads to show on the subdirectory pages and the root pages.. <? include("/home/USR/domains/DOMAIN/public_html/php/bottom.php") ?> Code (markup): where USR is my username and domain is the domain name The file bottom.php is in a subdirectory called /php and contains the following code <?php ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../'); include ('ad_network_375.php'); echo $ad_network; ?> Code (markup): the ad_network.php and ads.txt file are in the root directory on the same domain, all ads display on all pages.. but they won't validate.. I've noticed that on sites that are validating.. there is a class code placed with each lnik, on sites that won't validate, this class code is not present..