Skip to content

Commit e52299d

Browse files
authored
Merge pull request #1 from WyriHaximus/add-app
Add App
2 parents b0ea775 + a15d025 commit e52299d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM wyrihaximusnet/php:7.4-nts-alpine3.12
2+
3+
COPY versions.php /app/versions.php
4+
5+
ENTRYPOINT ["php", "/app/versions.php"]

versions.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
$versions = [];
4+
5+
$d = new DOMDocument();
6+
@$d->loadHTML(file_get_contents('https://php.net/supported-versions')); // the variable $ads contains the HTML code above
7+
8+
foreach ((new DOMXPath($d))->query('//a') as $link) {
9+
$url = $link->getAttribute('href');
10+
11+
if (strpos($url, '/downloads.php#v') === 0) {
12+
$versions[] = substr(
13+
$url,
14+
16,
15+
3
16+
);
17+
}
18+
}
19+
20+
echo 'Found the following supported versions: ', implode(', ', $versions), PHP_EOL;
21+
echo '::set-output name=versions::', json_encode($versions), PHP_EOL;

0 commit comments

Comments
 (0)