[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. ?php $host = www.microsoft.com; $path = /; $fh = fsockopen(ssl://.$host, 443, $errno, $errstr, 5);//opens url for reading with a timeout of 2 seconds if (!$fh){ echo FAIL: $errno $errstr ; } else{ $out = GET $path HTTP/1.1\r\n; $out .= Host: $host\r\n; $out .= Connection: Close\r\n; $out .= \r\n; fwrite($fh, $out); stream_set_timeout($fh,2); $info = stream_get_meta_data($fh); if($info['timed_out']){ echo TIMEOUT\n; } else{ $haystack = ; while (!feof($fh)) { $haystack.= fgets($fh, 4096); } } print $haystack; fclose($fh); } ? if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. ?php $host = www.microsoft.com; $path = /; $fh = fsockopen(ssl://.$host, 443, $errno, $errstr, 5);//opens url for reading with a timeout of 2 seconds if (!$fh){ echo FAIL: $errno $errstr ; } else{ $out = GET $path HTTP/1.1\r\n; $out .= Host: $host\r\n; $out .= Connection: Close\r\n; $out .= \r\n; fwrite($fh, $out); stream_set_timeout($fh,2); $info = stream_get_meta_data($fh); if($info['timed_out']){ echo TIMEOUT\n; } else{ $haystack = ; while (!feof($fh)) { $haystack.= fgets($fh, 4096); } } print $haystack; fclose($fh); } ? if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] fsockopen and SSL
i'm trying to make a POST request to my merchant's https server using the following: foreach($HTTP_POST_VARS as $key = $value){ $value = urlencode(stripslashes($value)); $req .= $key=$value; } $header .= POST /gw/native/direct2.1 HTTP/1.0\r\n; $header .= Content-Type: application/x-www-form-urlencoded\r\n; $header .= Content-Length: .strlen($req). \r\n\r\n; $fp = fsockopen('ssl://secure.netbilling.com', 443, $errno, $errstr, 30); if(!$fp){ echo $errstr($errno); } else { fputs($fp, $header . $req); while(!feof($fp)){ $res = fgets($fp, 1024); } fclose($fp); } but I get following error: Warning: fsockopen() [function.fsockopen]: no SSL support in this build in /usr/home/trivisions/html/sextoymerchant.com/payment/checkout_confirm.ph p on line 64 So does this mean that my PHP installation does not support SSL, and that I have to recompile PHP again? I looked at the PHP installation configure options but did not see anything regarding SSL, so how would I install this? I am running PHP Version 4.3.1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fsockopen and SSL
[snip] but I get following error: Warning: fsockopen() [function.fsockopen]: no SSL support in this build in /usr/home/trivisions/html/sextoymerchant.com/payment/checkout_confirm.ph p on line 64 So does this mean that my PHP installation does not support SSL, and that I have to recompile PHP again? I looked at the PHP installation configure options but did not see anything regarding SSL, so how would I install this? From the manual: php.net/fsockopen As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host. php.net/openssl To use PHP's OpenSSL support you must also compile PHP --with-openssl[=DIR]. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen() with SSL?
Hello, is it possible to fetch a Website via SSL? Greetings fom Germany Micha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fsockopen() with SSL?
At 14:11 28.02.2003, Michael Temeschinko said: [snip] Hello, is it possible to fetch a Website via SSL? [snip] Sure - have a look at cUrl... -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen() to ssl port gets protocol error
i'm doing a POST to an https server using fsockopen(). after doing the writes, i do fread($fp, 4096) until feof($fp) returns true. this seems to work fine, except that i get an SSL protocol error on the last read. can anybody with a better understanding of this give me an idea why that's happening? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php