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.

Perl -> PHP Coop Wrapper

Discussion in 'Co-op Advertising Network' started by clickdoc, Jan 18, 2005.

  1. mream

    mream Guest

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21

    Ok, duh, I got this one myself. I copied the code from coop_wrapper.cgi into my cgi templates and it now appears.

    THIS is my final question: where do I put the formatting (center, font, etc.)? Does it go in coop.php? in the cgi code? the html file?

    Thanks clickdoc for all your help!
     
    mream, Jan 28, 2005 IP
  2. seoxperts

    seoxperts Peon

    Messages:
    453
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #22
    were u able to do it in AWS3 ?
     
    seoxperts, Jan 28, 2005 IP
  3. mream

    mream Guest

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    No, I was doing it in my directory. I had some cgi pages that I had trouble with. Once I used the correct coop_wrapper code, and set my permissions correctly, it worked.
     
    mream, Jan 28, 2005 IP
  4. seoxperts

    seoxperts Peon

    Messages:
    453
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #24
    It worked in the directory for me as well, but not in perl based AWS. probably time to PM Nintendo :)
     
    seoxperts, Jan 29, 2005 IP
  5. mream

    mream Guest

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    THIS is my final question: where do I put the formatting (center, font, etc.)? Does it go in coop.php? in the cgi code? the html file?
     
    mream, Jan 31, 2005 IP
  6. chachi

    chachi The other Jason

    Messages:
    1,600
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    0
    #26
    you should not use tags like <center> or <font> these days. I would just put a div around the ads and then use CSS to format the text in your page template
     
    chachi, Jan 31, 2005 IP
  7. Free-toplist.biz

    Free-toplist.biz Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    freedom2...

    I now know how you feel... I cannot seem to get this working either.

    Please someone tell me where I have gone wrong.

    I am trying to set this up on this page

    www.online-web-design-course.com/forum/archive/o_t__t_92__flash-resources-tutorials.html

    If you look at the source you will see I have tried it in 2 ways without success.
     
    Free-toplist.biz, Feb 4, 2005 IP
  8. Kadence

    Kadence Well-Known Member

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #28
    To those who might be having problems with this, I suggest trying a subroutine with Clickdoc's code. e.g.,

    
    sub ShowAds{
    	#!/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.DOMAIN.COM/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 "<br/><div align=center>";
    	print $output;
    	print "</div>";
    }
    
    Code (markup):
    Place this anywhere in your .cgi file (probably at the end), then just call the subroutine in your .cgi file with ShowAds() in the proper location (most likely where the footer should go).

    For some reason this worked for me. If I placed the code in place of the subroutine, in the exact same location, I got an Internal Server Error; if instead I defined the subroutine and called that, it worked.

    With the div tag lines in there obviously being optional.
     
    Kadence, Feb 9, 2005 IP
  9. samsam

    samsam Peon

    Messages:
    647
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #29
    I am using the perl cgi php wrapper. The coop.php works fine and displays the coop ads, but when I call it via SSI includes, it does not show up anything. What do you think the problem is ?
     
    samsam, Mar 30, 2005 IP
  10. a389951l

    a389951l Must Create More Content

    Messages:
    1,885
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    140
    #30
    Clickdoc - will this work with the new php code. I noticed that the img tracking file is does not show in the cgi wrapper - most likely the content type needs to be changed for the image file? I haven't test whether or not this affects validation.
     
    a389951l, Apr 30, 2005 IP
  11. clickdoc

    clickdoc Guest

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #31
    The image tracking relies on the HTTP_USER_AGENT and it was not being passed, only the IP. Here is updated code for the wrapper, coop.php and the perl code need to be updated.

    ### start coop.php
    <?php
    $_SERVER['REMOTE_ADDR'] = $_GET['ip'];
    $_SERVER['HTTP_USER_AGENT'] = $_GET['agent'];

    include ('ad_network_218.php');
    echo $ad_network;
    ?>
    ### end coop.php

    ### 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://www.DOMAIN.COM/COOP.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
     
    clickdoc, May 2, 2005 IP
  12. clickdoc

    clickdoc Guest

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #32
    for those that don't want to update their files completly the only changes that need to be made are to:

    add:

    $ad_url .= qq{&agent=} . $ENV{HTTP_USER_AGENT};

    to your perl code right after this line:

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


    and then add:
    $_SERVER['HTTP_USER_AGENT'] = $_GET['agent'];

    to the top of your coop.php
     
    clickdoc, May 2, 2005 IP
  13. amateur

    amateur Well-Known Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    108
    #33
    Would anybody be interested in setting up the cgi version on a site for me ? I can't get it to work and need to get coop on to this site.
    I'll offer $100 to you cgi gurus to implement the code on my site.
    The site url is storesatellite.com . I have been trying to get this going for some months now and have almost no hair left :)


    Thanks for any help
     
    amateur, Jun 15, 2005 IP
  14. typoerror

    typoerror Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #34
    thank you clickdoc for sharing this very helpful tip!.

    cheers. :)
     
    typoerror, Dec 28, 2005 IP