1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Ads showing but failing validation

Discussion in 'Co-op Advertising Network' started by a389951l, Jan 7, 2005.

  1. Someone Else

    Someone Else Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Thank, this works great,

    just one question

    I am only seeing 1 ad show up..

    here is the code in my pages

    [!--#include virtual="/cgi-bin/coop_wrapper.cgi?ad_count=5;ad_separator= | "-->]

    I would like 5 ads to be visible

    Thanks
     
    Someone Else, Jan 7, 2005 IP
  2. clickdoc

    clickdoc Guest

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #22
    was just gonna post about that. the change actually has to be made in the coop.php file:


    <?php
    $_SERVER['REMOTE_ADDR'] = $_REQUEST['ip'];
    include ('ad_network.php');
    echo $ad_network[0] . ' | ' . $ad_network[1] . ' | ' . $ad_network[2] . ' | ' . $ad_network[3] . ' | ' . $ad_network[4];
    ?>
     
    clickdoc, Jan 7, 2005 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #23
    Oops... I edited my original post regarding the equal sign.

    A cleaner way for 5 ads separated by pipes is this:
    echo implode (' | ', $ad_network);
    PHP:
     
    digitalpoint, Jan 7, 2005 IP
  4. mream

    mream Guest

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Should this be in the cgi file, or in an html file?

    Thanks,
     
    mream, Jan 8, 2005 IP
  5. General Grant

    General Grant Well-Known Member

    Messages:
    318
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    160
    #25
    Alright, I'm totally missing something here, besides the boat. I have made the coop.php file, and the adnetwork.cgi file. What exactly do I put in my cgi file that I want to include the ads on? I have tried <!--#include virtual="/adnetwork.cgi" --> but it isn't working. I'm feeling mildly retarded right now......
     
    General Grant, Jan 12, 2005 IP
  6. clickdoc

    clickdoc Guest

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #26
    I've gotten a couple PM's from people having trouble so I am including a step by step setup for the wrapper. Both for people who need to include the wrapper code in an existing perl script and for those who are doing it using an SSI include.

    Here are the steps I use to set it up.

    First I make a directory /php/ on my server where php is enabled.

    Then I copy Shawn's ad_network.php into that directory and create ad_network_ads.txt and make it writable by the web process.

    Next I create coop.php in that directory with the following contents:

    <?php
    $_SERVER['REMOTE_ADDR'] = $_REQUEST['ip'];
    include ('ad_network.php');
    echo $ad_network[0] . ' | ' . $ad_network[1] . ' | ' . $ad_network[2] . ' | ' . $ad_network[3] . ' | ' . $ad_network[4];
    ?>

    This is to show 5 ads with a | separating them. To only show one add delete everything after $ad_network[0] up to but not including the semi colon.

    If you are displaying 5 ads then as Shawn pointed out a cleaner way to do the above is to replace that whole echo line with this one:

    echo implode (' | ', $ad_network);


    Then test this page by going to it in your web browser http://www.yourserver.com/php/coop.php

    You should see a coop ad. If you see an ad here then all that is left to do is to add the perl wrapper portion.

    If you have a perl script and need to put the coop inside it without calling an outside routine here is the code you can put right inside a script. Be sure to set the full http path to where you ran coop.php in the web browser successfully in the ad_url variable.


    ## START perl->php wrapper code

    use LWP::UserAgent;

    # set the full http path to the ad page here:
    my $ad_url = qq{http://www.yourserver.com/php/coop.php};

    $ad_url .= qq{?ip=} . $ENV{REMOTE_ADDR};

    my $output = '';

    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;
    }

    print $output;

    ## END perl->php wrapper code





    If you need to use it as a SSI and for some reason don't want to use php here is the code to put in your SSI included script. Be sure to set the full http path to where you ran coop.php in the web browser successfully in the ad_url variable.

    Note that number of ads and separator values are now set in the coop.php and not with parameters passed to the include as with the old perl version.



    #!/usr/bin/perl

    # $Id: coop_wrapper.cgi,v 1.2 2005/01/07 21:19:02 cvs Exp $
    # $Revision: 1.2 $

    use strict;
    use LWP::UserAgent;

    # set the full http path to the page here:
    my $ad_url = qq{http://www.yourserver.com/php/coop.php};

    $ad_url .= qq{?ip=} . $ENV{REMOTE_ADDR};

    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 $output;
     
    clickdoc, Jan 18, 2005 IP
  7. clickdoc

    clickdoc Guest

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0