jhsachs Posted November 29, 2011 Share Posted November 29, 2011 It seems to me that this should be easy, but I can't find it in the manual or the on the web, and the values in $_SERVER don't suggest anything. Context: script A loads script B using HTTPS. Now script B has to load resources (images, style sheets, etc). Browsers often object to HTTP references from a script run by an HTTPS request, so script B should generate URLs that use HTTPS. Thus it has to know that it was loaded with HTTPS. I can do this by brute force if I have to (defining a "protocol" constant in the script itself), but I'd rather make the test automatic. Quote Link to comment https://forums.phpfreaks.com/topic/252049-how-to-tell-is-the-request-for-http-or-https/ Share on other sites More sharing options...
ManiacDan Posted November 29, 2011 Share Posted November 29, 2011 Per the manual, if $_SERVER['HTTPS'] is set, the script was accessed through https. Quote Link to comment https://forums.phpfreaks.com/topic/252049-how-to-tell-is-the-request-for-http-or-https/#findComment-1292259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.