Can You Have 1 Ad_Network file for multiple domains

Discussion in 'Co-op Advertising Network' started by Someone Else, Sep 10, 2005.

  1. #1
    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..
     
    Someone Else, Sep 10, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Are the domains on the same server?
     
    digitalpoint, Sep 10, 2005 IP
  3. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Some would be on the same server, many would not
     
    Someone Else, Sep 10, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    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.
     
    digitalpoint, Sep 10, 2005 IP
  5. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The Techincal part, that's where it gets me :confused:

    what to change and how to call it.. I've tried some tweaks based on things I've read and am coming up empty..
     
    Someone Else, Sep 10, 2005 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    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).
     
    digitalpoint, Sep 10, 2005 IP
  7. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    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 ?
     
    Someone Else, Sep 10, 2005 IP
  8. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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.
     
    Someone Else, Sep 10, 2005 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    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.
     
    digitalpoint, Sep 10, 2005 IP
  10. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Shawn

    I'm not sure exactly how to code this
     
    Someone Else, Sep 11, 2005 IP
  11. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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..
     
    Someone Else, Sep 11, 2005 IP
  12. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #12
    What site is not validating?
     
    digitalpoint, Sep 11, 2005 IP