im using a very simple php script to retrive the text of a webpage;
$homepage = file_get_contents('http://192.168.1.125:6547/quickstatus');
echo $homepage;
But this instruction do not work on https, i dont have support for curl (im using a开发者_开发问答 php compiler), is any way to retrive the content of a page that use https whitout curl???
I think if the function file_get_contents
doesn't work with https address means that your installation of PHP has no openssl
extension installed. That's why curl
and other solutions will not be an option as well.
file_get_contents()
will work as long as PHP is compiled with openssl support. If your installation does not include it, you can recompile (or reinstall a binary version of) PHP.
Please note this caveat from the manual:
When using SSL, Microsoft IIS will violate the protocol by closing the connection without sending a close_notify indicator. PHP will report this as "SSL: Fatal Protocol Error" when you reach the end of the data. To work around this, the value of error_reporting should be lowered to a level that does not include warnings. PHP 4.3.7 and higher can detect buggy IIS server software when you open the stream using the https:// wrapper and will suppress the warning. When using fsockopen() to create an ssl:// socket, the developer is responsible for detecting and suppressing this warning.
If you are attempting to connect to a server running IIS, this may also be a solution.
You could use PEAR::HTTP_Request.
精彩评论