PHP code example of phasync / http-streamwrapper
1. Go to this page and download the library: Download phasync/http-streamwrapper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phasync / http-streamwrapper example snippets
ample usage within phasync coroutine framework
phasync::run(function() {
phasync::go(function() {
$data = file_get_contents("http://example.com");
// Handle the data
echo "Data from http://example.com: " . $data . PHP_EOL;
});
phasync::go(function() {
$data = file_get_contents("https://example.com");
// Handle the data
echo "Data from https://example.com: " . $data . PHP_EOL;
});
});