Page 1 of 1

problem with fsockopen()

Posted: Wed May 06, 2009 1:14 pm
by munishsethi777
Hi all, i m not a php guy but more of a .NET and java developer. Recently only i started on virtuaMart, Joomla and wanted to make use of USPS APIs for shipping rates etc.

I am facing a weird problem whose solution is not yet found in most of the forums or blogs.. its been 5 days i m banging my head here and there, but no luck yet.

here is the exception...
Warning: fsockopen() [function.fsockopen]: unable to connect to http://testing.shippingapis.com:0 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in D:\Mynxx\administrator\components\com_virtuemart\classes\shipping\usps.php on line 229
Now basically i use PHP5 installed alongwith NuSphere IDE.. i belive problem is somewhere in my phpsettings and not the code..
Here i must mention that my php.ini have the following extensions enabled as.

allow_url_fopen = On
extension=php_openssl.dll
extension=php_soap.dll
extension=php_sockets.dll

i am using protocol as "http"


Kindly assist..

Re: problem with fsockopen()

Posted: Wed May 06, 2009 5:12 pm
by John Cartwright
HTTP is not a registered socket transport. You need to omit the http:// in the fsockopen() call, i.e.

Code: Select all

fsockopen('yourdomain.com', 80,  ..')

Re: problem with fsockopen()

Posted: Wed May 06, 2009 10:50 pm
by munishsethi777
thanks john.

i tried it without http but still same problem persists..

How can we register http socket transport in my windows xp?

Re: problem with fsockopen()

Posted: Wed May 06, 2009 10:58 pm
by John Cartwright
HTTP is a stateless protocol. You do not stream with it (normally).

What is the exact error message you get when you omit the http://, and please post the relevant code.

Re: problem with fsockopen()

Posted: Thu May 07, 2009 2:35 am
by munishsethi777
Hi..

Thanks for your suggestion.. i read that on many forums to remove the http, but u really woke me up..(credit still goes to u)..

Actually when i was removing http:// i still was getting an error and as usual i was not really reading , it was all about parsing and not fsocket etc..

so finally i got it going and now USPS response is coming through very nicely...
I still have some problem in response, but thats not PHP thing, its on USPS part.

thanks again..

see u very soon.