Rev 1116 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1116 | Rev 1130 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | if ($oid == '') continue; |
39 | if ($oid == '') continue; |
40 | 40 | ||
41 | check_oid($oid); |
41 | check_oid($oid); |
42 | } |
42 | } |
43 | 43 | ||
- | 44 | /** |
|
- | 45 | * @param string $oid |
|
- | 46 | * @param string $root |
|
- | 47 | * @return void |
|
- | 48 | */ |
|
44 | function check_oid($oid, $root=DESIRED_ROOT) { |
49 | function check_oid(string $oid, string $root=DESIRED_ROOT) { |
45 | $data = ft_get_oid_data($oid); |
50 | $data = ft_get_oid_data($oid); |
46 | 51 | ||
47 | // ASN.1 IDs |
52 | // ASN.1 IDs |
48 | 53 | ||
49 | if (!isset($data['oid']['identifier'])) $data['oid']['identifier'] = array(); |
54 | if (!isset($data['oid']['identifier'])) $data['oid']['identifier'] = array(); |
Line 89... | Line 94... | ||
89 | 94 | ||
90 | echo "OK\n"; |
95 | echo "OK\n"; |
91 | 96 | ||
92 | # --- |
97 | # --- |
93 | 98 | ||
- | 99 | /** |
|
- | 100 | * @param string $oid |
|
- | 101 | * @return false|array |
|
- | 102 | */ |
|
94 | function ft_get_oid_data($oid) { |
103 | function ft_get_oid_data(string $oid) { |
95 | $url = OIDplus::baseConfig()->getValue('OIDINFO_API_URL') . '&oid='.urlencode($oid); |
104 | $url = OIDplus::baseConfig()->getValue('OIDINFO_API_URL') . '&oid='.urlencode($oid); |
96 | $cont_json = @file_get_contents($url); |
105 | $cont_json = @file_get_contents($url); |
97 | if (!$cont_json) { |
106 | if (!$cont_json) { |
98 | sleep(5); |
107 | sleep(5); |
99 | $cont_json = @file_get_contents($url); |
108 | $cont_json = @file_get_contents($url); |
100 | if (!$cont_json) return false; |
109 | if (!$cont_json) return false; |
101 | } |
110 | } |
102 | $data = json_decode($cont_json,true); |
111 | return json_decode($cont_json,true); |
103 | - | ||
104 | return $data; |
- | |
105 | } |
112 | } |