any idea how I can open a socket over the ssl???
I need to send an xml fille to an https://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
socket over ssl
Moderator: General Moderators
take a look at http://www.php.net/manual/en/ref.curl.php
socket over ssl example script
feyd | Please use
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]