Page 1 of 1

SSL and fsockopen() in PHP4

Posted: Thu Oct 13, 2005 9:52 am
by Bruno
Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi everyone,

I had this script that connects to a remote server over SSL, but I lost it
when moving my website to another server.
I had already struggled a lot in order to get the script working on the previous server.
And now that I am reconstructing it, I am running into trouble again.

I learned that [i]fsockopen()[/i] doesn't automatically support [i]SSL[/i]. 
However, by setting some option it could be enabled.
I have searched down php.net and came across [i]stream_context_set_option()[/i], 
but I cannot find the constants I need to indicate that I want to enable SSL.

Code: Select all

$fp=fsockopen("ssl://remotehost.org",5050, 13, "Not connected", 10);
	
	stream_context_set_option($fp,<wrapper: unknown>,<option:unknown>,<value:unknown>);

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]