0

I currently have a development environment, using HTTPS ports. Each site is setup with a different port number so I can connect to https://192.168.0.100:2001.

I'm trying to use PHP to do an async call, but cannot figure out how to do so using PHP. I've got a standard Ubuntu LAMP setup, and have OpenSSL installed.

Given the url https://192.168.0.100:2002, how would I make the fsocketopen call?

This is taken from the PHP fsockopen page.

$fp = fsockopen("ssl://www.example.com", 443, $errno, $errstr, 30);
Ryan Berger
  • 9,644
  • 6
  • 44
  • 56
user530077
  • 11
  • 3

3 Answers3

0

That "443" in the sample from the PHP page is the port number for that function call. Normally HTTPS calls go over 443, but it looks like you're overriding that. Change the second parameter to 2001, 2002, etc. and it will connect to your various servers.

MidnightLightning
  • 6,715
  • 5
  • 44
  • 68
  • Here's the kicker though, Apache is listening in on 443 for SSL. But even if I change it to be 443, I still get the dreaded "plain text over ssl" message in the apache logs. – user530077 Feb 09 '11 at 13:14
  • If apache is listening over 443, it can't be listening over 2001 at the same time. It must be that apache is listening over 443 and is considering the ":2001" to be part of the domain name requested, and serves a different site accordingly. So, does `fsockopen('192.168.0.100:2001', 443, $errno, $errstr, 30)` work? – MidnightLightning Feb 11 '11 at 17:34
0
<?php $fp = fsockopen("192.168.0.100", 2002, $errno, $errstr, 30); ?>
KomarSerjio
  • 2,861
  • 1
  • 16
  • 12
0

dunnow 'bout fsockopen

i'd rather use file_get_contents() with (optionally) stream_context_create($opts)

depends on the data you recieve.

david.wosnitza
  • 763
  • 4
  • 10