[PHP] snapshot windows build
In order to open an encrypted socket using fsockopen(), I downloaded and built the latest snapshot from snaps.php.net. It works great on my FreeBSD box - however, now I need to run the code on a Windows server. When I try, though, I receive this error message: Warning: fsockopen(): no SSL support in this build in c:\inetpub\wwwroot\robot\robotclient.php4 on line 28 From skimming through the source, it appears this means that the binary was built on a computer without OpenSSL support - does anyone know where I can get a binary for Windows that was built with OpenSSL? Thanks in advance, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: secure sockets
Richard Lynch wrote: $hostname = 'ssl://155.246.211.23'; You have to be running PHP 4.3.0 (IE, CVS or snapshot) to use 'ssl://' with fsockopen, according to the manual. You may have to use cURL for now, or develop in 4.3.0 and deploy when it's ready, or... I tried mucking around with cURL for a bit, but couldn't figure out a way to use encryption with telnet (not to mention that documentation/example code for the telnet feature is non-existant). So, I tried building the the latest snapshot of 4.3.0. Now when I try to use fsockopen(); with ssl:// I receive this message: Warning: fsockopen(): no SSL support in this build in /usr/home/research/htdocs/tests/secure2.php4 on line 6 I did include OpenSSL support...is there something else I need to include? --Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: secure sockets
Josh Levine wrote: Warning: fsockopen(): no SSL support in this build in /usr/home/research/htdocs/tests/secure2.php4 on line 6 I did include OpenSSL support...is there something else I need to include? Nevermind, I just re-built it from scratch again and it worked. Now I'm just having trouble matching cipher suites, but I think that's more of a Java thing than a PHP thing. --Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] secure sockets
I'm trying to connect to a Java application that's listening on a socket using SSL. I am trying to use fsockopen with the address beginning with ssl://, but it doesn't work. There's no error message that I can find, it just doesn't create the file-handler. Here's some sample code: ? $hostname = 'ssl://155.246.211.23'; $portnumb = '60324'; $sock = fsockopen($hostname, $portnumb, $errno, $errstr); fwrite($sock, 9\n); print ( fgets($sock,6) ); print $errno; print $errstr; fclose($sock); ? That returns: Warning: fwrite(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 8 Warning: fgets(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 10 0 Warning: fclose(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 20 Thanks in advance for any help, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure sockets
Thanks for the pointer! I had looked at it, but didn't see too much information on using CURL with a telnet type application. I'll take a closer look at it. --Josh Levine Patrick Lynch wrote: Hi Josh, I have not done this myself but afaik, you can use curl to so this. http://www.php.net/manual/en/ref.curl.php Best Regards, Patrick Lynch. Optip Ltd, Internet Mobile Development Co. Clare, Ireland. http://www.optip.com/ -Original Message- From: Josh Levine [mailto:[EMAIL PROTECTED]] Sent: 23 July 2002 19:57 To: [EMAIL PROTECTED] Subject: [PHP] secure sockets I'm trying to connect to a Java application that's listening on a socket using SSL. I am trying to use fsockopen with the address beginning with ssl://, but it doesn't work. There's no error message that I can find, it just doesn't create the file-handler. Here's some sample code: ? $hostname = 'ssl://155.246.211.23'; $portnumb = '60324'; $sock = fsockopen($hostname, $portnumb, $errno, $errstr); fwrite($sock, 9\n); print ( fgets($sock,6) ); print $errno; print $errstr; fclose($sock); ? That returns: Warning: fwrite(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 8 Warning: fgets(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 10 0 Warning: fclose(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 20 Thanks in advance for any help, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure sockets
The docs for fsockopen() say I should use ssl:// (the docs for fopen() say to use https:// for a secure HTTP 1.0, which I don't want). I can go ahead and try it, though... --Josh Levine Peter wrote: josh just a query did u try it with https:// rather than ssl:// ? -Original Message- From: Josh Levine [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 24 July 2002 9:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] secure sockets Thanks for the pointer! I had looked at it, but didn't see too much information on using CURL with a telnet type application. I'll take a closer look at it. --Josh Levine Patrick Lynch wrote: Hi Josh, I have not done this myself but afaik, you can use curl to so this. http://www.php.net/manual/en/ref.curl.php Best Regards, Patrick Lynch. Optip Ltd, Internet Mobile Development Co. Clare, Ireland. http://www.optip.com/ -Original Message- From: Josh Levine [mailto:[EMAIL PROTECTED]] Sent: 23 July 2002 19:57 To: [EMAIL PROTECTED] Subject: [PHP] secure sockets I'm trying to connect to a Java application that's listening on a socket using SSL. I am trying to use fsockopen with the address beginning with ssl://, but it doesn't work. There's no error message that I can find, it just doesn't create the file-handler. Here's some sample code: ? $hostname = 'ssl://155.246.211.23'; $portnumb = '60324'; $sock = fsockopen($hostname, $portnumb, $errno, $errstr); fwrite($sock, 9\n); print ( fgets($sock,6) ); print $errno; print $errstr; fclose($sock); ? That returns: Warning: fwrite(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 8 Warning: fgets(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 10 0 Warning: fclose(): supplied argument is not a valid File-Handle resource in /usr/home/research/htdocs/tests/secure.php on line 20 Thanks in advance for any help, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: secure sockets
Richard Lynch wrote: Here's some sample code: ? $hostname = 'ssl://155.246.211.23'; You have to be running PHP 4.3.0 (IE, CVS or snapshot) to use 'ssl://' with fsockopen, according to the manual. You may have to use cURL for now, or develop in 4.3.0 and deploy when it's ready, or... It will be pretty cool when the SSL stuff can be done as transparently as http:// can right now! Can't believe I missed the version thing - thanks! I guess I'll try using cURL for now until 4.3.0 comes out...it'll definitely make things very nice. --Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure sockets
Mike Mannakee wrote: I have not done this but have studied enough tcp/ip to know that ssl is not a protocol. The opening portion would refer to your protocol, like http or ftp. One would access via ssl using https://, not ssl:// Try that. According to the docs, 4.3.0 will support such a call (I just didn't notice the version number). Curl would be your other option, and that should work just fine for most uses. I don't know how you have the app set up but that may be what you need. That's what I'll try next. --Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP sockets/daemon problem
I'm trying to write a simple PHP script that communicates with a daemon running on the same server. Basically, the daemon just accepts an integer and returns an integer: [josh@jlevine-research josh]$ telnet 127.0.0.1 60324 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 9 25Connection closed by foreign host. When I try doing this with PHP, however, the output is 2[]5 (where [] == a small square symbol). Here is the script: ?php $fp = fsockopen(127.0.0.1, 60324, $errno, $errstr); if (!$fp) { echo ERROR: $errno - $errstrbr\n; } else { socket_set_blocking ($fp, 1); socket_set_timeout($fp, 200); fwrite($fp,9\n); $return = fread($fp,4); echo $return; fclose($fp); } ? I've tried various string format and type-casting functions with no results (usually just returns nothing after formatted). Any ideas? Thanks in advance, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets/daemon problem
Thanks! Those were a huge help...turns out the problem was with the daemon and not my code. --Josh Levine B I G D O G wrote: Some great articles for sockets...might help out... http://www.phpbeginner.com/columns/demitrious/sockets http://www.phpbeginner.com/columns/demitrious/sockets-connection B i g D o g - Original Message - From: Josh Levine [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 11:32 AM Subject: [PHP] PHP sockets/daemon problem I'm trying to write a simple PHP script that communicates with a daemon running on the same server. Basically, the daemon just accepts an integer and returns an integer: [josh@jlevine-research josh]$ telnet 127.0.0.1 60324 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 9 25Connection closed by foreign host. When I try doing this with PHP, however, the output is 2[]5 (where [] == a small square symbol). Here is the script: ?php $fp = fsockopen(127.0.0.1, 60324, $errno, $errstr); if (!$fp) { echo ERROR: $errno - $errstrbr\n; } else { socket_set_blocking ($fp, 1); socket_set_timeout($fp, 200); fwrite($fp,9\n); $return = fread($fp,4); echo $return; fclose($fp); } ? I've tried various string format and type-casting functions with no results (usually just returns nothing after formatted). Any ideas? Thanks in advance, Josh Levine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php