Page 1 of 1
socket over ssl
Posted: Thu Nov 21, 2002 2:33 pm
by chifi
any idea how I can open a socket over the ssl???
I need to send an xml fille to an http
s://
www.example.com/etc/etc and the server will only accept a socket over ssl....
(just so you know I am trying to create a shopping cart application that makes use of th UPS online tools)...
Thank you,
Cip
Posted: Thu Nov 21, 2002 3:25 pm
by volka
socket over ssl example script
Posted: Wed Oct 06, 2004 5:25 pm
by saidwords
feyd | Please use Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Here is an example script that works for me:
* this example only gets a page from the server, it does not POST a page to the server. but it shouldnt be difficult to modify it to do so.
Code: Select all
$fp = fsockopen ("ssl://192.168.0.28", 443, $errno, $errstr, 30 );
if (!$fp) {
echo "<br>ERROR: $errstr ($errno)";
} else {
$request = "GET / HTTP/1.0\r\n";
$request .= "Host: 192.168.0.28\r\n";
$request .= "Connection: Close\r\n\r\n";
fputs ($fp, $request);
print "waiting for response...\n";
while (!feof($fp)) {
$result = fgets($fp,1024);
print "$result\n";
}
fclose($fp);
}
feyd | Please use Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Posted: Wed Oct 06, 2004 5:27 pm
by feyd
Please take note that this thread is almost 2 years old.
