From 452cb2c0b57401395ce25a8e4ac2af8fc14cd8a8 Mon Sep 17 00:00:00 2001 From: Caio Lima Date: Fri, 6 Oct 2017 17:12:24 -0300 Subject: [PATCH] =?UTF-8?q?=C3=AFnitial=20phase=20of=20io=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i-o/README.md | 28 +++++++------- i-o/index.php | 43 +++++++++------------ i-o/src/fclose.php | 3 ++ i-o/src/file_get_contents.php | 3 ++ i-o/src/file_put_contents.php | 3 ++ i-o/src/fopen.php | 3 ++ i-o/src/fwrite-fgets-fread-feof-example.php | 10 +++++ 7 files changed, 53 insertions(+), 40 deletions(-) create mode 100644 i-o/src/fclose.php create mode 100644 i-o/src/file_get_contents.php create mode 100644 i-o/src/file_put_contents.php create mode 100644 i-o/src/fopen.php create mode 100644 i-o/src/fwrite-fgets-fread-feof-example.php diff --git a/i-o/README.md b/i-o/README.md index 60bd2b6..a8748d9 100644 --- a/i-o/README.md +++ b/i-o/README.md @@ -1,17 +1,15 @@ -```php -setData($data); - } +This section covers Array functionality on IO - public static function getInstance($data) - { - if (!empty($data)) return new static($data); - } -} -``` \ No newline at end of file +# Code Examples +[Here](code) + +# PHP Official Documentation + +* https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html +* http://php.net/manual/pt_BR/function.fopen.php +* http://php.net/manual/pt_BR/function.fclose.php +* http://php.net/manual/en/book.sockets.php +* http://php.net/manual/pt_BR/ref.filesystem.php +* http://php.net/manual/pt_BR/class.splfileinfo.php \ No newline at end of file diff --git a/i-o/index.php b/i-o/index.php index c286351..3bf1176 100644 --- a/i-o/index.php +++ b/i-o/index.php @@ -1,11 +1,5 @@ [ -// 'proxy' => 'ftp://proxy:3128' -// ], -// ]; -// $params = []; -// $context = stream_context_create($options, $params); -// print(file_get_contents('ftp://speedtest.tele2.net/', false, $context)); -// exit; -// print_r(file_get_contents('./zce.txt')); -// $contexto = stream_context_create([ -// 'http' => [ -// 'method' => 'POST', -// 'header' => 'Content-Type: application/x-www-form-urlencoded', -// 'content' => 'livro=php', -// ], -// ] -// ); -// print file_get_contents('http://marabesi.com', false, $contexto); +$options = [ + 'ftp' => [ + 'proxy' => 'ftp://proxy:3128' + ], +]; +$params = []; +$context = stream_context_create($options, $params); +print(file_get_contents('ftp://speedtest.tele2.net/', false, $context)); +exit; +print_r(file_get_contents('./zce.txt')); +$context = stream_context_create([ + 'http' => [ + 'method' => 'GET', + 'header' => 'Content-Type: text/html', + ], + ] +); +print file_get_contents('http://www.google.com', false, $context); // $put = fopen('php://input', 'r'); // print fgets($put); diff --git a/i-o/src/fclose.php b/i-o/src/fclose.php new file mode 100644 index 0000000..a73442c --- /dev/null +++ b/i-o/src/fclose.php @@ -0,0 +1,3 @@ +