escape, I’m beginning to feel that no information regarding the presence of a certificate is passed unless you are coming through the HTTPS scheme, and that because the HTTPS scheme cannot be accessed via a simple TCP socket connection, if you cannot specify this, you have a non-starter.
Using the “fsockopen” function, gets me in, but I then need to use “ssl://” in front of my URL (and not “https://”). Notes from the PHP site state that this method is not supported on Windows machines until possibly version 4.5 CVS unless you obtain a special DLL, and not supported otherwise if PHP is not compiled with OpenSSL support (which unfortunately is a funky level of if/and/but compatibility for what I’m looking to do).
That said, I tried this on my Unix box (compiled with OpenSSL support!), and it still did not return the cert headers via “fsockopen” (if there is a different function you’d recommend, let me know). I used it like this:
$fp = fsockopen(“ssl://login.yahoo.com”, 443, $errno, $errstr, $timeout=30);
It returned the same results as cURL (without verbose mode “on”).
Here is what cURL (and fsockopen) is returning via SSL (without verbose mode “on”):
>> curl -I https://login.yahoo.com
HTTP/1.0 200 OK
Date: Fri, 31 Oct 2003 17:18:11 GMT
P3P: policyref=“http://p3p.yahoo.com/w3c/p3p.xml”, CP=“CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV”
Cache-Control: private
Pragma: no-cache
Expires: Thu, 05 Jan 1995 22:00:00 GMT
Connection: close
Content-Type: text/html
This is cURL with verbose mode turned on:
>> curl -I -v https://login.yahoo.com
- Connected to login1.login.vip.dcn.yahoo.com (216.109.127.60) port 443
- SSL connection using EDH-RSA-DES-CBC3-SHA
- Server certificate:
-
subject: /C=US/ST=California/L=Santa Clara/O=Yahoo/OU=Yahoo/CN=login.yahoo.com
-
start date: 2003-02-08 00:00:00 GMT
-
expire date: 2004-02-08 23:59:59 GMT
-
common name: login.yahoo.com (matched)
-
issuer: /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
> HEAD / HTTP/1.1
User-Agent: curl/7.10.2 (i386-redhat-linux-gnu) libcurl/7.10.2 OpenSSL/0.9.6b ipv6 zlib/1.1.3
Host: login.yahoo.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, /
HTTP/1.0 200 OK
Date: Fri, 31 Oct 2003 17:18:36 GMT
P3P: policyref=“http://p3p.yahoo.com/w3c/p3p.xml”, CP=“CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV”
Cache-Control: private
Pragma: no-cache
Expires: Thu, 05 Jan 1995 22:00:00 GMT
Connection: close
Content-Type: text/html
It appears as if the “HEAD” or “header” only starts after the certificate, and that for whatever reason, this isn’t be returned in fsockopen.
I’ve been looking over all the comments on the function, and looking at the docs, and this seems like a perplexing bit of esoterica that I can’t seem to locate.
http://us4.php.net/manual/en/function.fsockopen.php
~ DNexus