Forum Moderators: coopster
Thanks for your help and time in the matter.
I have got a bit further with running the TestHash.e file from the command line however it is saying 'Error generating hash!.
I have set both the permissions for TestHash.e and the libCcCpiTools.so to 755. Still no luck.
Your help appreciated...
./TestHash.e 1234567890abcdef=/+1234567890abc "Monkey"
If it were having problems with libraries or permissions - you could get a more 'linux-y' error (File not Found, Cannot Load Library etc). As I said before - be VERY careful when typing your HashKey from the printed version - you really have to check the O's carefully (no dot inside them, and they're a capital letter - a dot inside means they are numeric). Hope this helps!
Everyone: Could someone please confirm that the libCcCpiTools.so file you have is 65536 bytes big? I'm pretty sure that the file is actually damaged - and I have a feeling that the file that HSBC have been sending out is damaged :(. On that note - I don't suppose anyone has an email address to contact the techy-people with? (Don't really wanna phone about insanely technical stuff like this and get 'regular phone people' that won't understand about linux programming ;))
I have uploaded the windows version of my php module, php_hsbccpi. Unfortunately, I cannot compile it from within linux because it will not link with the (apparently broken) file 'libCcCpiTools.so' - which means the linux version is kind of useless until it can ;). When I get it working under linux as well, I will publish the full source code (there's not much) - but it's a real mess at the moment as I've been hacking it to make it work under both OS'es (and didn't realise that error was down to a broken lib until after much playing...) Still - you can now generate an orderHash with 1 line of PHP :)
[edited by: jatar_k at 4:55 pm (utc) on Aug. 17, 2004]
[edit reason] removed url [/edit]
So, 2 more updates for you guys. First of all, the linux version of the php module is now there for your downloading pleasure. At only a 5Kb download, why not give it a shot? It allows you to generate your orderHash with only 1 or 2 lines of PHP script - whoo! Comes with a detailed readme file on setting it up too! [angryrooster.co.uk ].
Also, I'm not entirely sure if I'm allowed to distribute this file (I can't see why not though), but I've uploaded the full (fixed) version of the libCcCpiTools.so file for those of you with the 64Kb version. I'm not going to publish a link on my site to it though, and I'll be removing it in a couple of weeks just incase it's not meant for prying eyes. You can find that one here: [angryrooster.co.uk ]. It's gzipped - so it's only 35Kb to download or so... Enjoy!
I tried yoru code (there is a minor parse error - missing semicolon on line 13), without loading your library at startup (through PHP). It might just be my Fedora system, but the second condition fails with the runtime download.
I modified your code slightly to take this possibility into account, by introducing a $loaded variable which is true if the library loads correctly at runtime.
This is how it looks.
<?php
/*
* This if-block is not required if you are loading the module from php.ini
*/
if (!extension_loaded("php_hsbccpi")){
$loaded = dl("php_hsbccpi.so");
}
if (extension_loaded("php_hsbccpi") &&!$loaded) {
echo "The module 'php_hsbccpi' could not be loaded - your order will not process through the HSBC CPI.";
} else {
$hashKey = "12345678901234567890123456789012"; /* Your 32-Digit Hash Key */
$variables = array( "Here", "Are", "Some", "Variables" );
$orderHash = _hsbccpi_generate_hash($variables, $hashKey);
}
if ( empty($orderHash) ) {
echo "Order Hash was not set! Please ensure that the hashKey supplied was correct!";
} else {
echo "Order Hash was generated: {$orderHash}";
}
?>
Thanks again, Cristiano
Would any one be willing to a fake or a dummy Hash Key (I mean one that has the correct format but doesnt belong to anyone) - hope that made sense.
Oh by the way my libCcCpiTools.so file is 81kb if that helps.
if (!extension_loaded("hsbcCpi")){
$loaded = dl("php_hsbccpi.so");
}if (extension_loaded("hsbcCpi")) {
die();
} else {
// Do Your Worst with the Hash!
}
If it's still not working - are you sure you have the 85Kb libCcCpiTools.so in '/usr/lib', and that php_hsbccpi.so is sitting in '/usr/lib/php4' (or your php extensions dir). If this doesn't work - what version of PHP are you using?
Luigi: Of course - just throw an email my way if you have any problems, and I'll help all I can! I'll usually respond pretty quick - if I'm at work. For some 'dummy' hash keys - I've just written a tiny php script to generate some, try these 'esfmrwwruiu6tk5lsfq6p/gu3sak2z/w', '1er3nfa6ks37xlq59orfj019kxpsb1t'. They should see you through until the end of testing.
Everyone: New versions of the modules are available for download. The Linux one just has an updated readme - I think the PHP should work this time (but can't test it on my windows box). However, I have made an Important Update to the Windows Module - in that, it now works on more than a tiny selection of machines (stupid bug - grr). Version 1.0.0 probably won't work - so if you've got it, overwrite it with this one. Also, the readme was updated (and tested) with working code. Enjoy!