PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
include ("https://www.website.com/folder/file2.php")
An error is displayed in the browser that says,
"No such file or directory in /path_to_httpdocs/file1.php"
It seems the include function doesn't support https because if I type "http://www.website.com/folder/file2.php" directly into my web browswer it gets displayed correctly. Does anyone know of a different method to do this?
Thanks for the fast replay. A couple of reasons. First, the remote file that I want to include is on a different server in a differnt network so system path will not work. The other reason is that file2.php gathers information off of the remote server before getting displayed as part of file1.php in the browser.
Hmm, it may be a problem with certificates. I know that when I'm browsing pages, and I go to an https connection from an http connection, I get a browser pop up. Is it possible that a similar situation is happening here? I would imagine that by default, Apache (and IIS for that matter, but who knows about that?) would reject certificates it doesn't know about.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
If anyone is interested, I found out how to do it. You need to use sockets and have php compiled with the openssl support enabled (--with-openssl=/usr/local/ssl). This is basically how my code looks now. The strlen conditional is there because I was getting extra characters returned, I think because of the encryption.
Just make sure the secure page you are connecting to is trusted because it seems none of the secure site alerts occur like you are used to seeing while using a web browser. I.E. certificate expired, not from a trused C.A., and common name checking.