{"id":12278,"date":"2019-03-22T09:38:10","date_gmt":"2019-03-22T08:38:10","guid":{"rendered":"http:\/\/www.wjst.de\/blog\/?p=12278"},"modified":"2019-03-22T21:57:51","modified_gmt":"2019-03-22T20:57:51","slug":"test-before-redirect","status":"publish","type":"post","link":"https:\/\/www.wjst.de\/blog\/sciencesurf\/2019\/03\/test-before-redirect\/","title":{"rendered":"Test before redirect"},"content":{"rendered":"<p>I need to test if a ssl server is likely to respond before doing any forward as I would otherwise &#8220;loose&#8221; a projection screen.<br \/>\nAs the server uses only a self-signed certificate, basically all javascript tricks (iframe on the fly, jsonp, &#8230;) failed either due to Cross-Origin Resource Sharing (CORS) rules. Even after switching to php the first two methods failed (get header, fsockets) while I finally ended with a simple curl request<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$ch = curl_init();\r\ncurl_setopt($ch, CURLOPT_URL, 'https:\/\/localhost:8443');\r\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n$response = curl_exec($ch);\r\ncurl_close($ch);\r\nif (curl_error($ch)&#x5B;0]==&quot;&quot;) header('Location: https:\/\/localhost:8443');\r\n<\/pre>\n\n<p>&nbsp;<\/p>\n<div class=\"bottom-note\">\n  <span class=\"mod1\">CC-BY-NC Science Surf , accessed 29.04.2026<\/span>\n <\/div>","protected":false},"excerpt":{"rendered":"<p>I need to test if a ssl server is likely to respond before doing any forward as I would otherwise &#8220;loose&#8221; a projection screen. As the server uses only a self-signed certificate, basically all javascript tricks (iframe on the fly, jsonp, &#8230;) failed either due to Cross-Origin Resource Sharing (CORS) rules. Even after switching to &hellip; <a href=\"https:\/\/www.wjst.de\/blog\/sciencesurf\/2019\/03\/test-before-redirect\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Test before redirect<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-12278","post","type-post","status-publish","format-standard","hentry","category-computer-software"],"_links":{"self":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/12278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/comments?post=12278"}],"version-history":[{"count":4,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/12278\/revisions"}],"predecessor-version":[{"id":12285,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/12278\/revisions\/12285"}],"wp:attachment":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/media?parent=12278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/categories?post=12278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/tags?post=12278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}