Gossamer Forum
Home : General : Perl Programming :

Amazon code not working :(

Quote Reply
Amazon code not working :(
Can anyone see why this code will not work?

Code:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:standard/;
use strict;

print "Content-type: text/html \n\n";

# define variables...
my ($assoc_id,$search,$mode);
$search = "wild";
$assoc_id = "bn23-21";
$mode = "all";
my $image_size = "small";
my $bgcolor = "FFFFFF";
my $bgshade = "F0F8FF";

my $amazon_results = &get_amazon_results($assoc_id,$search,$mode);
foreach my $product (@{$amazon_results->{product}})
{
my $image = $product->{image}[0] if !ref $product->{image}[0];;
my $small_image = $product->{small_image}[0] if !ref $product->{small_image}[0];
$image = $small_image if $image_size eq "small";

print "<tr valign=top bgcolor=\#$bgcolor>";
print "<td>", img {src=>$image,align=>'LEFT',alt=>$product->{title}[0]}, "</td>";
print "<td align=left>", a({href=>$product->{tagged_url}[0]}, $product->{title}[0]), br;
print "<i>By: ", $product->{author}[0], "</i>, ", $product->{binding}[0], " edition", br;
print "List Price: ", $product->{list_price}[0], ";" if !ref $product->{list_price}[0];
print " Our Price: ", $product->{our_price}[0] if !ref $product->{our_price}[0];
print "</td>";
print "</tr>\n";
print "<tr><td colspan=2>\&nbsp;</td></tr>";

if ($bgcolor eq "FFFFFF") {
$bgcolor = $bgshade;
}
else {
$bgcolor = "FFFFFF";
}
}

sub get_amazon_results() {
my ($t,$search,$mode) = @_;
use LWP;
use HTTP::Request;
use XML::Simple;
use Data::Dumper;

my $url="http://rcm.amazon.com/e/cm?t=$t&l=st1&search=$search&mode=$mode&p=102&o=1&f=xml";
my $method="GET";
my $ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.04 (X11; I; NetBSD 1.3 i386; Nav)");
$ua->timeout("30");
my $request = new HTTP::Request($method, $url);
my $response = $ua->request($request);
my $return = $response->content;

my $doc=XMLin($return, forcearray=>1);
return $doc;
}

No error is returned...it simply just returns a blank page. I've checked into the URL that is called, and that seems to be o. I'm just totally stumped Unimpressed

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Amazon code not working :( In reply to
Have you checked what $return contains and then $doc before it is returned?
Quote Reply
Re: [Paul] Amazon code not working :( In reply to
Never mind....its working now Smile

Another problem I have come accross (which Amazons affiliate message board, FAQ's and demo scripts do not address), is how I would go about searching all products? I have tried using;

mode=all
mode=

... and even totally removing the mode= part. Maybe someone who has already played with this could give me a hand Smile

Thanks in advance.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Amazon code not working :( In reply to
Again, I have to ask why reinvent the wheel? Modules have been written for this kind of stuff and they have been proven to work, so you don't need to tear your hair out. Check out:

http://search.cpan.org/...=amazon&mode=all

- wil
Quote Reply
Plugin Support, please In reply to
Hi, Andy;

Can you make a support page or forum for your plugins and plugin owners? I've been checking for months with no luck. As a plugin owner, I have spent many hours wrestling with them overall.

As you spend many hours making up cool and useful plugins, I ask that you also put a portion of your time in towards supporting, documenting, upgrading, and fixing what already exists.

At least plugin owners could trade hints, usage tips, and fixes even without your daily input.

Also, you do have FOUR links to your site in your signature, and one of them says "Plugin Owners Area". I would expect product support or a forum or FAQ's to be there, but instead it is a 2nd sales page, which I do not feel is fair.

I am very glad that you are making plugins, don't get me wrong!
Quote Reply
Re: [webslicer] Plugin Support, please In reply to
Quote:
Also, you do have FOUR links to your site in your signature, and one of them says "Plugin Owners Area". I would expect product support or a forum or FAQ's to be there, but instead it is a 2nd sales page, which I do not feel is fair.

Its not a second sales page Wink If you have purchased any of my plugins, you get a login, where you can go in download the plugins you own, and purchase any future ones. I'm working on adding a forum....but its pretty busy my end, and its hard to find time to setup a forum, and then the 25+ forums for the plugins Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Plugin Support, please In reply to
Andy,

That's great. Looks like you changed it. How about emailing present owners with logins and passwords, then?

As far as support goes, fixing faults in existing products and writing documentation clear enough so that the somewhat experienced plugin installer can utilize the power of them should be a priority.

Here's an example where an update should be made:

Your excellent and wonderful searchfeed_results plugin will do NOTHING as installed!

Why? After hours of digging, I found that your account has been de-activated and your code does not check for an error message from searchfeed.com. So no error message is displayed.
Yes, you say to sign up and get our own codes, but you also say "Please be sure to refer me when signing up with SearchFeed" well, we can't as your account has been suspended.
Quote Reply
Re: [webslicer] Plugin Support, please In reply to
http://www.gossamer-threads.com/...i?post=234739#234739

Thats the thread where I let people know that they can request a login for the new site.

Quote:
Your excellent and wonderful searchfeed_results plugin will do NOTHING as installed!

Why? After hours of digging, I found that your account has been de-activated and your code does not check for an error message from searchfeed.com. So no error message is displayed.
Yes, you say to sign up and get our own codes, but you also say "Please be sure to refer me when signing up with SearchFeed" well, we can't as your account has been suspended.


Wow! I wasn't aware of that. Would have been nice if they had sent me an email letting me know my account was de-activated Frown I have $20 in there too Mad I'm gonna shoot an email off to them now, and have a go at them!

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Plugin Support, please In reply to
Not too nice of them, huh!
I've had it happen myself, and after a few emails it's like "Well, we DON'T know why!" and the status is re-activated.
Once, I was told we had chargebacks from Bulgaria or whereabouts... but still, we were re-activated. I've never been to Europe and don't play any games with traffic, so who knows!

Anyways, one of my points Andy is also that you need to check for error messages (And pass them on to the LINKS user or admin), as in AMAZON as well.

Negatively Changed affiliate links happen OFTEN, so I really suggest that you need to check for them... it's a must, certainly if the plugin has the capability to earn income from clicks....
Quote Reply
Re: [webslicer] Plugin Support, please In reply to
Yeah. I'm going to be re-doing several of my plugins soon. I've had quite a few large jobs to do recently, so it has been pretty hard finding time. I'm hoping to have them completed by the end of next week Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Plugin Support, please In reply to
What kind of large jobs? I'm interested...
Quote Reply
Re: [Andy] Amazon code not working :( In reply to
Do you know what a niche market is?
Quote Reply
Re: [webslicer] Plugin Support, please In reply to
In Reply To:
What kind of large jobs? I'm interested...

They are custom jobs....obviously I can't go around spreading who I am doing them for, etc Tongue

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Paul] Amazon code not working :( In reply to
In Reply To:
Do you know what a niche market is?

Erm, yeah I do. What does it have to do with this topic though? Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Amazon code not working :( In reply to
Webslicer was talking about pages on your website, and thats a word I found on one of the pages :)

It says that paid script installations is a niche market Laugh
Quote Reply
Re: [Paul] Amazon code not working :( In reply to
You can state in general terms what you are doing, Andy!
(unless the CIA is watching... and then they might hire you)

It's good for business.

example:

Custom website design including graphics and layout for mid sized company, utilizing PERL and PHP programming to integrate real time messaging with LINKS SQL.
Quote Reply
Re: [webslicer] Amazon code not working :( In reply to
Well, if you must know. Its an online dating site, for people all over the world. Covers all the countries in the world, with multiple languages etc. Has a pay feature, so people can get access to user profiles, and more Smile

As I said, its pretty targeted to the user who needs it Tongue (and its a one off contract fee, so I can't resell it...they want complete rights to it).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Paul] Amazon code not working :( In reply to
In Reply To:
installations is a niche market Laugh

Mmm...what page was this on? I don't remember typing that. You are correct in saying that the sentance does not make sense Tongue

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!