Reviewed & tested by the community
Project:
Amazon associate tools
Version:
5.x-1.6
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
23 Jul 2009 at 17:37 UTC
Updated:
3 Dec 2025 at 09:47 UTC
Jump to comment: Most recent file
Comments
Comment #1
Chad_Dupuis commentedI would like to know the answer to this as well. The documentation on Amazon is a little unclear on how to accomplish this. I'll look into it as best as I can....
Comment #2
Chad_Dupuis commented-deleted-
-ignore this patch file-
Comment #3
Chad_Dupuis commented-deleted-
Comment #4
Chad_Dupuis commentedComment #5
Chad_Dupuis commentedOk, now I appear to have it - even if it is a little bit of a hack.
I've attached two patch files - one for amazon.module and the other for amazon.php5.inc to get AWS authenticated requests working.
Two caveats (well 3, this is a little bit of a hack) - I've hardcoded the locale for the US as I didn't take the time to properly adjust for different locales, and this will only work for php 5, as I didn't clean up any of the php4 functions.
These are patched from a slightly hacked 1.5 version so YMMV with applying these, but all the code is there. I would guess the php5.inc would apply fine and the amazon.module should as well, but it may complain about some line differences....
Anyhow, apply these patches, then go to the module setup - add your aws public and secret keys and all should be well.
For this to be rolled into a release, it would need some error checking, the locale properly set, and perhaps some other mild cleaning, but it does work so far as my testing has shown. Should you have any problems, feel free to ask.
Comment #6
asb commentedHi Chad,
thanks for the patch; it applies cleanly to my 5.x-1.6 installations.
> Two caveats (well 3, this is a little bit of a hack) - I've hardcoded the locale for the US as I didn't take the time to properly
> adjust for different locales [...]
I'm not sure, what this exactly means for non-US sites. Even if the module is configured to "DE" at ./admin/settings/amazon, it seems to no longer accept products with ASINs from amazon.de (e.g. for German books; error message: "Nicht im Katalog von Amazon: %asin existiert nicht"); generic ASINs (e.g. for hardware) seem to be accepted, however prices are outputted in USD, and the links are pointing to amazon.com (resulting in invalid referrals).
Basically the patch seems to break non-US installations of the "Amazontools" module completely: Neither new nodes can be created, nor can existing amazon nodes be edited. I've no idea yet if this affects existing products in the Drupal database (I hope it's not changing all link targets...)
Maybe you could give advice what we have to hack to get the correct locale back?
Thanks & greetings, -asb
Comment #7
kleppten commentedHaving the same problem here with Amazon.de
Working with Drupal 5 and PHP 4.
Any advice welcomed. Will dig my self into the code, but looks complicated....
eric
Comment #8
Chad_Dupuis commentedYeah, I'm sorry I couldn't do a better job for all the countries. However, I believe all you have to change is the following $host line in the .inc file:
// Additional Parameters
+ $method = "GET";
+ $host = "ecs.amazonaws.com";
+ $uri = "/onca/xml";
$host would be whatever it needs to be for de - ecs.amazonaws.de?
Comment #9
kleppten commentedThanks Chad,
it worked. Could it even appy to PHP4 version with the hash_mac-hack, found here.
http://www.a2sdeveloper.com/page-rest-authentication-for-php4.html
Thanks
ek
Comment #10
asb commentedHi Chad,
thank you very much, changing the mentioned line manually makes "Amazontools" operable again; Amazon nodes can be created and edited again.
If someone is able to roll an enhanced patch we should make a 5.x-1.7 release since version 5.x-1.6 is as of August 15th completely useless...
Thanks to all helping out to keep this module alive!
Greetings, -asb
Comment #11
Chad_Dupuis commentedI'll try to do this, as time permits. Most of the code would be fine, it's just where I hardcoded the host variable to avoid having to strip off the way it is set within the current module.
It would only be a line or two different.
Comment #12
tela commentedThanks a lot for this patch.
It works fine for me with an installation for Amazon.fr.
I put
$host = "ecs.amazonaws.fr";instead of$host = "ecs.amazonaws.com";as advised and it's working perfectly.I still have a question. Do I need to do anything to the old links already existing on the website?
Cecile.
Comment #13
Chad_Dupuis commentedNo, the existing links should be fine.
Comment #14
khan2ims commentedHi,
Thanks this worked for me too!
Comment #15
a_c_m commentedSounds like we need it rolled... anyone willing to step up and be rhe person to take on the legacy?
Comment #16
Chad_Dupuis commentedI'd be willing to try to roll a correct release, but I would need cvs access and all of that to do it properly. Not entirely sure where to begin with that as it appears the current maintainer is out of touch...
I'll write him and see if either he will be willing to write a patch or if he can add me as a co-maintainer and I'll do it.
Comment #17
Chad_Dupuis commentedI've tried to contact the maintainer to no avail - so I've put in a request to take over the project - http://drupal.org/node/608868
Assuming they let me in, if anyone else wants to work on a new release or knows of any other patches that should make it in to a new release, please let me know....
Comment #18
a_c_m commentedThanks for stepping up!
Comment #19
MGParisi commentedSorry that it has taken me SO long to respond! I am getting married, and have been in a steady state of chaos for a few months. I have not had access to my computer, the website, or this email address for this period of time. But Now I am BACK!
I am sure I am going to have problems getting access to my devel account, so it may take some time. Chad_Dupuls, I just got your email, and yes you can take maintainer or co-maintainer of the project. I took over this project awhile ago, as to include and improve a bunch of things. I need to focus my attention on upgrading to D6, so I have little time to improve this module :(
I would love help to maintain it, however I will apply the patch. Is the country patch the better solution, or simply the last PATCH posted?
Thanks
Mike
Comment #20
Chad_Dupuis commentedCongrats on getting married. The patch that is posted works but is a bit of a hack (as it only works for the US unless you modify the code). I'll try to clean it up in the next day or so and post it back so you can make a new release.... I don't really care about maintaining/co-maintaining unless you need the help, I was just trying to get this patch in... so feel free to do with that request as you please. If you want to add me as a maintainer, I'll try to roll a new release myself.....
Comment #21
a_c_m commentedI can confirm with modifying the code it works in the UK.
Comment #22
Chad_Dupuis commentedOk, I've attached three patch files for amazon.module, amazon.php5.inc, and the README which could be used to make a new release. These are built off of 1.6 and they check for the locale and set the appropriate url without needing to edit the code. Someone (hopefully more than one), however, should check that these work as I no longer have a working d5 site to test with.
If they are good, feel free to roll a new release with them.
UPDATED 11/27/2009 - don't use amazon.php5.inc file from these - use the updated one below....
Comment #23
aircat commentedHi ek,
is this a question or do you have a solution for PHP4?
If so, would you share it?
Danke!
Martin
Comment #24
Chad_Dupuis commentedI didn't do the php4 file - but you could build a similar patch for the php4.inc file using the instructions here - if you look at the patch file above for php5 inc and replace the encryption part with what is on the following amazone page
http://www.a2sdeveloper.com/page-rest-authentication-for-php4.html
it should work. If you cannot figure it out, let me know and I'll try - but not only do I not have a d5 site to test on, I don't have anything with php4 on it either, so it would be better for someone else to build the patch...
Comment #25
MGParisi commentedI am currently out of the Drupal Development loop. I dont have a test site to apply these too, so I will have to wait a bit till I get my brains together and start back up in Drupal.
I am not going to support PHP4, and will not test for it. If someone disagrees with this decision, and they want to step up and help maintain this project, feel free.
I would love some help maintaining this project. Right now life is more important the Drupal, and I fear that I may not be able to apply this as fast as I would like. I would hate to see people not be able to upgrade!
Thanks
Mike
Comment #26
aircat commentedChad & Mike, thanks you for your work and for offering help!
I finaly managed it to get proper signed requests in PHP4, was a bit of pain in the ... ;)
The Developer site http://www.a2sdeveloper.com/page-rest-authentication-for-php4.html is not very well maintained, there are some major errors in the code. The function-calls are wrong, and the mentioned library sha256.in.php is not working as expected (maybe only on my system ...)
I found an excellent replacement for the library here:
http://code.google.com/p/redwidow-dna/downloads/list
So I added this code to amazon.php4.inc:
and extended the function amazon_get_XML():
@Chad: The localisation part in your amazon.php5.inc is wrong!
The new amazon.php4.inc is attached here, please feel free to use, enhance and improve it.
Martin
Comment #27
Chad_Dupuis commentedUpdated amazon.php5.inc file that appears to work (goes along with the readme and amazon module patches above for a new release).... Thanks Martin for catching the locale problems...
Comment #28
andre75 commentedThis used to work until now. Has Amazon changed their API again?
Comment #29
mcurry commentedI'm seeing breakage again, after a long period of everything working (after applying the patch, that is). Anyone else?