Rev 485 | Rev 597 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
484 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
511 | daniel-mar | 5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
484 | daniel-mar | 6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | $url = 'https://www.viathinksoft.de/'; |
||
21 | |||
22 | if (!function_exists("curl_init")) { |
||
23 | echo '<p><font color="red">CURL not installed!</font></p>'; |
||
24 | die(); |
||
25 | } |
||
26 | |||
27 | $ch = curl_init(); |
||
28 | if (ini_get('curl.cainfo') == '') { |
||
29 | if (file_exists(__DIR__.'/../3p/certs/cacert.pem')) { |
||
30 | curl_setopt($ch, CURLOPT_CAINFO, __DIR__.'/../3p/certs/cacert.pem'); |
||
31 | echo '<p>Loaded fallback CURLOPT_CAINFO from OIDplus</p>'; |
||
32 | } |
||
33 | else if (file_exists(__DIR__.'/3p/certs/cacert.pem')) { |
||
34 | curl_setopt($ch, CURLOPT_CAINFO, __DIR__.'/3p/certs/cacert.pem'); |
||
35 | echo '<p>Loaded fallback CURLOPT_CAINFO from OIDplus</p>'; |
||
36 | } else { |
||
37 | echo '<p><font color="red">curl.cainfo is missing and fallback certificates (3p/certs/cacert.pem) not found</font></p>'; |
||
38 | } |
||
39 | } |
||
40 | curl_setopt($ch, CURLOPT_URL, $url); |
||
41 | curl_setopt($ch, CURLOPT_HEADER, TRUE); |
||
42 | curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body |
||
43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
||
44 | $head = curl_exec($ch); |
||
45 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
||
46 | curl_close($ch); |
||
47 | |||
48 | if ($httpCode != 0) { |
||
49 | echo '<p><font color="green">CURL to HTTPS works!</font></p>'; |
||
50 | } else { |
||
51 | echo '<p><font color="red">CURL to HTTPS does not work!</font></p>'; |
||
353 | daniel-mar | 52 | } |