diff --git a/www/index.php b/www/index.php index a87d8f1..958fc97 100644 --- a/www/index.php +++ b/www/index.php @@ -67,95 +67,165 @@ p { p:last-child { font-size: 200%; } - -.pl-c { - color: #969896; -} - -.pl-c1, .pl-s .pl-v { - color: #0086b3; -} - -.pl-e, .pl-en { - color: #795da3; -} - -.pl-smi, .pl-s .pl-s1 { - color: #333; -} - -.pl-ent { - color: #63a35c; -} - -.pl-k { - color: #a71d5d; -} - -.pl-s, .pl-pds, .pl-s .pl-pse .pl-s1, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sre, .pl-sr .pl-sra { - color: #183691; -} - -.pl-v { - color: #ed6a43; -} - -.pl-id { - color: #b52a1d; -} - -.pl-ii { - background-color: #b52a1d; - color: #f8f8f8; -} - -.pl-sr .pl-cce { - color: #63a35c; - font-weight: bold; -} - -.pl-ml { - color: #693a17; -} - -.pl-mh, .pl-mh .pl-en, .pl-ms { - color: #1d3e81; - font-weight: bold; -} - -.pl-mq { - color: #008080; -} - -.pl-mi { - color: #333; - font-style: italic; -} - -.pl-mb { - color: #333; - font-weight: bold; -} - -.pl-md { - background-color: #ffecec; - color: #bd2c00; -} - -.pl-mi1 { - background-color: #eaffea; - color: #55a532; -} - -.pl-mdr { - color: #795da3; - font-weight: bold; -} - -.pl-mo { - color: #1d3e81; -} + + + @@ -163,19 +233,28 @@ p:last-child {

Easily send HTTP requests and integrate with web APIs

- - $curl = new Curl();
- $curl->get('https://www.example.com/');
-
- if ($curl->error) {
-     echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n";
- } else {
-     echo 'Success! Here is the response:' . "\n";
-     var_dump($curl->response);
- }
-
+
+$curl = new Curl();
+$curl->get('https://www.example.com/');
+
+if ($curl->error) {
+    echo 'Error: ' . $curl->errorMessage . "\n";
+    $curl->diagnose();
+} else {
+    echo 'Success! Here is the response:' . "\n";
+    var_dump($curl->response);
+}
+
+    
+

+ + https://github.com/php-curl-class/php-curl-class + +

+

get('https://www.example.com/'); + +if ($curl->error) { + echo 'Error: ' . $curl->errorMessage . "\n"; + $curl->diagnose(); +} else { + echo 'Success! Here is the response:' . "\n"; + var_dump($curl->response); +} diff --git a/www/scripts/highlight_code.js b/www/scripts/highlight_code.js new file mode 100644 index 0000000..f0f7b76 --- /dev/null +++ b/www/scripts/highlight_code.js @@ -0,0 +1,11 @@ +const fs = require('fs'); +const Prism = require('prismjs'); +const loadLanguages = require('prismjs/components/'); +loadLanguages(['php']); + +const source = fs.readFileSync('code.php', 'utf8'); +const lines = source.split(/\n/); +const code = lines.slice(1).join('\n'); +const html = Prism.highlight(code, Prism.languages.php, 'php'); + +console.log(html); diff --git a/www/scripts/highlight_code.sh b/www/scripts/highlight_code.sh new file mode 100755 index 0000000..0aacac7 --- /dev/null +++ b/www/scripts/highlight_code.sh @@ -0,0 +1,2 @@ +npm install prismjs +node highlight_code.js diff --git a/www/scripts/package.json b/www/scripts/package.json new file mode 100644 index 0000000..ef97485 --- /dev/null +++ b/www/scripts/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "prismjs": "*" + } +}