How to: Use the Digital co-op with MrRats Amazon Products Feed script.

Discussion in 'Co-op Advertising Network' started by Nintendo, Nov 12, 2005.

  1. #1
    I'm not sure which board this should go in, just guessing that most of the APF users will be up here in the Amazon board instead of the co-op set-up board.

    Create a co_op.mod file in your /mods/ directory with this text, and follow the instructions in it.

    
    # Filename: DigitalPoint co-op
    # version: 1
    # copyright: Nintendo, aka Jesse Smith
    # license: GPL - http://www.opensource.org/licenses/gpl-license.html
    # purpose: Be able to use Digital Points co-op in the APF directory.
    # http://www.digitalpoint.com/tools/ad-network/
    #
    # First follow the instructions at
    #
    # http://www.digitalpoint.com/tools/ad-network/setup.php?type=99
    #
    # For Step #4, create an ad_network_perl_###.php file in the directory
    # with ### being your number, with the content shown in Step 4.
    #
    # In this file, change
    #
    # $dpcoop = get ('http://www.domain.com/ad_network_perl_###.php');
    #
    # to your domain and number in the php file name.
    #
    # In the template place %%coop%% where you want links to show up.
    
    use vars qw(%MY_variables %subs__co_op);
    
    %subs__co_op = ( calculate_initial_variables => "Yes" );
    
    sub calculate_initial_variables__co_op {
       my (@coop, $co_op);
    require $Internal_variables{cwd} . "/SimpleGet.pl"; 
    $dpcoop = get ('http://www.domain.com/ad_network_perl_###.php');
    
       $MY_variables{coop} = $dpcoop;
    }
    1;
    
    Code (perl):

     
    Nintendo, Nov 12, 2005 IP
    myamar likes this.
  2. a389951l

    a389951l Must Create More Content

    Messages:
    1,885
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    140
    #2
    wow nice Jesse - now I can finally move up to the new version of the script.
     
    a389951l, Nov 12, 2005 IP
  3. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the instructions. I tried it, but it didn't work. I followed your instructions to the letter. Might you be available for some consultation??
     
    Caveman, Nov 18, 2005 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    Did you turn the hack on at cgi-bin/apf_config.cgi ?

    If you did, what shows up at...
    http://www.domain.com/ad_network_perl_###.php

    If you can't get that working, I can test out two lines of code that I use in an older version.
     
    Nintendo, Nov 18, 2005 IP
  5. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Wow! I don't even have a apf_config.cgi! Would you mind having a look? I can pm you the cpanel login.

    Thanks
     
    Caveman, Nov 19, 2005 IP
  6. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #6
    It looks like you got an old version! Do you have an apf_main.pm file in the same directory as amazon_products_feed.cgi

    At the very top for

    # version 4.050820

    what does it say??

    For version

    # version 2.021207

    I added

    use LWP::Simple;
    $dpcoop = get ('http://www.domain.com/ad_network_444_perl.php');

    after

    # required changes:

    and down in the

    $html .= qq[<CENTER><FONT Size="1">script by <A Href="http://www.MrRat.com/" Target="_new">MrRat</A></FONT></CENTER>];

    line I added

    <BR><B>$dpcoop</B> before <center>

    I think that'll work with any version.
     
    Nintendo, Nov 19, 2005 IP
    Caveman likes this.
  7. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The only thing I've got in my /cgi-bin/amazon dir is apf_xml_cache, apf_xml_cache.lock and shop.html.

    shop.html looks like what should be the apf_main.pm. I have version 3.040314 at the top.

    I'll try the last part of the code you posted and let you know. I really appreciate all the help.
     
    Caveman, Nov 19, 2005 IP
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    Yep, that looks like the older version before the mod stuff and extra files came along. If that little change doesn't work, I don't know what will. The newest version is

    4.0510## (November ## 2005.)
     
    Nintendo, Nov 19, 2005 IP
  9. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It worked!!! Thanks so much for the help. One last question, how hard would it be to update to the latest version of the script? This site has a custom template and I'm not sure it would be easy to do.

    Once again, thanks for all the help.
     
    Caveman, Nov 19, 2005 IP
  10. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #10
    The templates have been updated since then. Make a post over on MrRats boards.
     
    Nintendo, Nov 19, 2005 IP
  11. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Will do. Thanks again.
     
    Caveman, Nov 20, 2005 IP
  12. webvivre

    webvivre Peon

    Messages:
    249
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Has anyone got this script to work?
     
    webvivre, Jan 24, 2006 IP
  13. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #13
    apf_main.pm

    At the top part of the script, add a # before

    use strict vars;

    that was generating the ISE message, and add the other code after it, with domain.com and ### changed....

    
    #	version 4.051120,	coded by MrRat - http://www.mrrat.com,  GPL licensed - http://www.opensource.org/licenses/gpl-license.html
    #use strict vars;
    
    use LWP::Simple;
    $dpcoop = get ("http://www.domain.com/ad_network_###_perl.php");
    
    sub build_products__main {
    
    Code (perl):
    Then search for script by MrRat and change that code to
    
    	my $apf_footer = qq[<div class="apf_footer"><a href="http://www.mrrat.com/scripts.html" target="_blank">script by MrRat</a><BR>$dpcoop];
    
    Code (perl):
    for it to show up at the very bottom of the page.

    Then look through your directory all the way to Amazon. I don't think geting rid of
    use strict vars;
    will mess anything up.
     
    Nintendo, Jan 24, 2006 IP
  14. ActiveFarming

    ActiveFarming Active Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #14
    I'm using apf version 4.051111 and this mod forces 500 errors when enabled. I haven't figured out why yet...
     
    ActiveFarming, Apr 13, 2006 IP
  15. ActiveFarming

    ActiveFarming Active Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #15
    I don't know what I'm doing wrong. I followed all of the instructions indicated here. I then tried apfmods version and followed those instructions. I tried every combination I can think of... even tried different permissions.

    When I turn the mod on and go to http://www.domain.com/ad_network_perl_###.php, the ads show fine. But then nothing in the APF works. I get 500 errors. As soon as I turn the mod off, the strore works great.

    I have other mods working good.

    I also tried this on two other sites, all with the same result...

    Can anyone help?
     
    ActiveFarming, Apr 13, 2006 IP
  16. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #16
    Do you have the text file in the same directory as the script?

    No permission is needed for the php file. Make sure the text file is 777.

    Take out %%coop%% and see if the script works or still creates the error.
     
    Nintendo, Apr 13, 2006 IP
  17. ActiveFarming

    ActiveFarming Active Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #17
    I have the text file and the php file in the websites main directory, store directoy, and mod directory.

    The mod is in the mod directory.

    I took out %%coop%%.

    I set 777 to all 3 text files.

    I tried changing "$dpcoop = get ('http://www.etc'); to all three php locations.

    After every change, I get a 500 error for the store.

    The php file shows the ads when called in the main directory but not in the cgi-bin directories (500 error).

    Does the mod need special permissions?

    Any other suggestions?
     
    ActiveFarming, Apr 14, 2006 IP
  18. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #18
    I never had to set a permission for the mod file.

    What ever URL

    $dpcoop = get ('http://www.domain.com/ad_network_perl_###.php');

    points to is where you need it. If you have SSH access, get on, go to the directory with the main script, and enter

    perl amazon_products_feed.cgi

    and post the error message. And post the code you currently got at

    domain.com/cgi-bin/mods/co_op.mod

    and I'll test that out.
     
    Nintendo, Apr 14, 2006 IP
  19. ActiveFarming

    ActiveFarming Active Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #19
    For some reason, .cgi doesn't do well on my server so I use .pl instead.

    I followed your instructions and this is what is shown in my ssh client:

     [root@onesv01 store]# perl store.pl
    Location:apf_config.pl
    
    Code (markup):
    No error messages...

    But I still get 500 errors for the store...

    here is my coop.mod file:
    
    # Filename:   DigitalPoint co-op
    # version:      1
    # copyright:   Nintendo, aka Jesse Smith
    # license:   GPL - http://www.opensource.org/licenses/gpl-license.html
    # purpose:  Be able to use Digital Points co-op in the APF directory.
    # http://www.digitalpoint.com/tools/ad-network/
    #
    # First follow the instructions at
    #
    # http://www.digitalpoint.com/tools/ad-network/setup.php?type=99
    #
    # For Step #4, create an ad_network_perl_###.php file in the directory
    # with ### being your number, with the content shown in Step 4.
    #
    # In this file, change
    #
    # $dpcoop = get ('http://www.domain.com/ad_network_perl_###.php');
    #
    # to your domain and number in the php file name.
    #
    # In the template place %%coop%% where you want it to show up.
    
    use vars qw(%MY_variables %subs__co_op);
    
    %subs__co_op = ( calculate_initial_variables => "Yes" );
    
    sub calculate_initial_variables__co_op {
       my (@coop, $co_op);
    require $Internal_variables{cwd} . "/SimpleGet.pl"; 
    $dpcoop = get ('http://www.go-israel.com/ad_network_perl_224.php');
    
       $MY_variables{coop} = $dpcoop;
    }
    
    # file must end with this 1;
    1;
    
    Code (markup):
     
    ActiveFarming, Apr 14, 2006 IP
  20. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #20
    cgi-bin/store/mods/coop.mod
    should be
    cgi-bin/store/mods/co_op.mod
     
    Nintendo, Apr 14, 2006 IP