My first Magento experience
On a fairly recent project I'd been working on a webstore using Magento.
Magento is an open source system using PHP and the Zend Framework.
One thing that we needed in this project was automatic shipping calculation with Canada Post... we found a module that gave that functionality and purchased it.
The installation process seemed pretty straight forward, went through the process and the module was then listed in Magento's configuration.
But the module wasn't working. The author of the module had written a test script which I began using to test with.
This module needed to use port 30000 to connect with the canada post system.. I contacted my technical support with the hosting provider and concluded that the port was open. I then used telnet and got a valid response (from the server).
I had also used another PHP script to connect with the canada post successfully which used stream_socket_client() and had programmed (for my own fun) a small test script in ColdFusion which had successfully connected....
After lot's of lookin' around, reading forum posts on Magento's forums, help from a twitter contact and trying a couple of PHP lists I had nothing. I was suspecting that somehow it was the PHP config or the curl command ... so I spent time looking that up.
After a bit, I was in contact with the module's author who suggested a couple of things. One of these things I had sworn I had tried... but must not of... or made the change in code and hadn't uploaded the file to the server in a tired state of mind....
It was to do with options for the curl command. The original code used was something like this:
$url = 'http://sellonline.canadapost.ca:30000';
$port = '30000';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, $port);
So the suggestion was to add the port directly to the url... and get rid of the curlopt_port... which looked something like this:
$url = 'http://sellonline.canadapost.ca:30000';
curl_setopt($ch, CURLOPT_URL, $url);
// and comment out the port opt
//curl_setopt($ch, CURLOPT_PORT, $port);
By not using curlopt_port and adding the port to the URL.... it worked beautifully.
I should mention that this was being hosted on CentOS. Not exactly sure why it is that it wouldn't work... but it worked with the little fix.... and since this little fix there has been NO glitch.
Works perfectly!
Thanks to the module's author!






