note 123893 added to function.file

From: Date: Wed, 29 May 2019 22:25:18 +0000
Subject: note 123893 added to function.file
Groups: php.notes 
Request: Send a blank email to php-notes+get-211142@lists.php.net to get a copy of this message
As of PHP 5.6 the file(), file_get_contents(), and fopen() functions will return false if you are referencing a source URL that doesn't have a valid SSL certificate. Presumably, you will run into this a lot in your development environments this will drive you crazy. You will need to create a stream context and provide it as an argument to the various file operations to tell it to ignore invalid SSL credentials. $args = array("ssl"=>array("verify_peer"=>false,"verify_peer_name"=>false),"http"=>array('timeout' => 60, 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/3.0.0.1')); $context = stream_context_create($args); $httpfile = file($url, false, $context); ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.157.34 (proxied: 99.52.202.177) ---- Manual Page -- http://php.net/manual/en/function.file.php Edit -- https://master.php.net/note/edit/123893 Del: integrated -- https://master.php.net/note/delete/123893/integrated Del: useless -- https://master.php.net/note/delete/123893/useless Del: bad code -- https://master.php.net/note/delete/123893/bad+code Del: spam -- https://master.php.net/note/delete/123893/spam Del: non-english -- https://master.php.net/note/delete/123893/non-english Del: in docs -- https://master.php.net/note/delete/123893/in+docs Del: other reasons-- https://master.php.net/note/delete/123893 Reject -- https://master.php.net/note/reject/123893 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211142) next »