Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading a page with file() - Problems with https

Cord-Heinrich Pahlmann
Guest
 
Posts: n/a
#1: Jan 28 '07
Hi,

I need the HTML content of an extern webpage.
Normally I just use file(http://externpage); to read the contents.
But with file(httpS://externpage); i get an error.
The script is running under http://, so that is probably the problem
since http can't send to https (right?).

Is there some workarround. I just need the the <formdata from the
extern page.

Thx, for any suggestions.


=?iso-8859-1?q?Joachim_M=E6land?=
Guest
 
Posts: n/a
#2: Jan 28 '07

re: Reading a page with file() - Problems with https


On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
Quote:
But with file(httpS://externpage); i get an error.
What kind of error...?

What OS and webserver is the remote site running?

What OS, PHP version and webserver is your local site running?
Quote:
The script is running under http://, so that is probably the problem
since http can't send to https (right?).
No..! HTTP/HTTPS is a question of unencrypted or encrypted communication
between PHP running the script with the file() function and the remote
site. How you invoked the script is not an issue.
Quote:
Thx, for any suggestions.
Ditto, for anything resembling a clue of what you're experiencing... ;-)

--
Regards/mvh Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti.

Michael Fesser
Guest
 
Posts: n/a
#3: Jan 28 '07

re: Reading a page with file() - Problems with https


..oO(Cord-Heinrich Pahlmann)
Quote:
>I need the HTML content of an extern webpage.
>Normally I just use file(http://externpage); to read the contents.
>But with file(httpS://externpage); i get an error.
What error?
Quote:
>The script is running under http://, so that is probably the problem
>since http can't send to https (right?).
According to

HTTP and HTTPS
http://www.php.net/manual/en/wrappers.http.php

PHP needs OpenSSL support compiled-in to access HTTPS resources.

Micha
Cord-Heinrich Pahlmann
Guest
 
Posts: n/a
#4: Jan 28 '07

re: Reading a page with file() - Problems with https




On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
Quote:
On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
Quote:
But with file(httpS://externpage); i get an error.What kind of error...?
>
What OS and webserver is the remote site running?
I have no clue.
Quote:
>
What OS, PHP version and webserver is your local site running?
I have a xampp test enviroment (Apache w/ PHP 4.4.4).
I'm sorry, but when I uploaded the script to my webhoster it worked.
So it might be an issue with the OpenSSL support as Micha suggested.
I just looked at the phpinfo() pages of both configs and on both
systems is openSSL enabled. My hoster has an older version, though.
But that shouldn't be the problem.


The error I get from my localhost is the following:
Warning: file(https://SITE) [function.file]: failed to open stream:
Invalid argument in ... on line...
It works fine with normal HTTP.

Since, the script is running on my webspaces I'm fine. But I still
would really like to know why it isn't working from localhost.

lorento
Guest
 
Posts: n/a
#5: Jan 29 '07

re: Reading a page with file() - Problems with https


1. Check your firewall.
2. Check your internet connection wether use proxy or not to access
internet.
--
http://www.mastervb.net
On Jan 29, 5:34 am, "Cord-Heinrich Pahlmann" <S...@Heineken2000.de
wrote:
Quote:
On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
>
Quote:
On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
Quote:
But with file(httpS://externpage); i get an error.What kind of error....?
>
Quote:
What OS and webserver is the remote site running?I have no clue.
>
>
>
Quote:
What OS, PHP version and webserver is your local site running?I have a xampp test enviroment (Apache w/ PHP 4.4.4).
I'm sorry, but when I uploaded the script to my webhoster it worked.
So it might be an issue with the OpenSSL support as Micha suggested.
I just looked at the phpinfo() pages of both configs and on both
systems is openSSL enabled. My hoster has an older version, though.
But that shouldn't be the problem.
>
The error I get from my localhost is the following:
Warning: file(https://SITE) [function.file]: failed to open stream:
Invalid argument in ... on line...
It works fine with normal HTTP.
>
Since, the script is running on my webspaces I'm fine. But I still
would really like to know why it isn't working from localhost.
=?iso-8859-1?q?Joachim_M=E6land?=
Guest
 
Posts: n/a
#6: Jan 29 '07

re: Reading a page with file() - Problems with https


On Sun, 28 Jan 2007 14:34:09 -0800, Cord-Heinrich Pahlmann wrote:
Quote:
On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
Quote:
>>
>What OS and webserver is the remote site running?
>
I have no clue.
Buggy IIS and line endings from a MAC are easy to overcome, but obviously
not what's giving you problems. Never mind the question.
Quote:
I have a xampp test enviroment (Apache w/ PHP 4.4.4). I'm sorry, but
when I uploaded the script to my webhoster it worked. So it might be an
issue with the OpenSSL support as Micha suggested. I just looked at the
phpinfo() pages of both configs and on both systems is openSSL enabled.
My hoster has an older version, though. But that shouldn't be the
problem.
Micha said it all...
http://bugs.php.net/bug.php?id=28234
http://bugs.php.net/bug.php?id=38798

<guesswork>
I think the SSL entry you are looking for is an "ssl" entry under
"Registered Stream Socket Transports" in the phpinfo() page. And probably
an "https" entry under "Registered PHP Streams".
</guesswork>
Quote:
The error I get from my localhost is the following: Warning:
file(https://SITE) [function.file]: failed to open stream: Invalid
argument in ... on line...
It works fine with normal HTTP.
>
Since, the script is running on my webspaces I'm fine. But I still would
really like to know why it isn't working from localhost.
Your PHP installation is probably broken from the maintainer. Try an
upgrade, your distro's own PHP package or build PHP yourself, using bits
and bytes... ;-)

--
Regards/mvh Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti.

P Pulkkinen
Guest
 
Posts: n/a
#7: Jan 29 '07

re: Reading a page with file() - Problems with https


This all below is my opinion, not any official post though...

1) have a debugging/error handling system. It is not so difficult to make, I
have made one myself and it really often helped us in development.

2) test code ALL the time, after every couple of lines, not in big chunks.

3) leave debugging features inside, even if you use simple lines like:
echo "now variable i = $i";
comment it, when you don't need it, but keep it there!

4) name varables in a way that even others understand them
$person['phone'] is good name , $p['p'] is bad.

5) put useful comments here and there. don't think commenting is waste of
time. avoid excessive egoboost comments, though.



Captain Paralytic
Guest
 
Posts: n/a
#8: Jan 29 '07

re: Reading a page with file() - Problems with https




On 29 Jan, 13:40, "P Pulkkinen"
<perttu.POISTATAMA.pulkki...@POISTATAMA.elisanet.f iwrote:
Quote:
This all below is my opinion, not any official post though...
>
1) have a debugging/error handling system. It is not so difficult to make, I
have made one myself and it really often helped us in development.
>
2) test code ALL the time, after every couple of lines, not in big chunks.
>
3) leave debugging features inside, even if you use simple lines like:
echo "now variable i = $i";
comment it, when you don't need it, but keep it there!
>
4) name varables in a way that even others understand them
$person['phone'] is good name , $p['p'] is bad.
>
5) put useful comments here and there. don't think commenting is waste of
time. avoid excessive egoboost comments, though.
What has this got to do with the original subject?

Umberto Salsi
Guest
 
Posts: n/a
#9: Jan 29 '07

re: Reading a page with file() - Problems with https


"P Pulkkinen" <perttu.POISTATAMA.pulkkinen@POISTATAMA.elisanet.f iwrote:
Quote:
This all below is my opinion, not any official post though...
>
1) have a debugging/error handling system. It is not so difficult to make, I
have made one myself and it really often helped us in development.
>
2) test code ALL the time, after every couple of lines, not in big chunks.
>
3) leave debugging features inside, even if you use simple lines like:
echo "now variable i = $i";
comment it, when you don't need it, but keep it there!
>
4) name varables in a way that even others understand them
$person['phone'] is good name , $p['p'] is bad.
>
5) put useful comments here and there. don't think commenting is waste of
time. avoid excessive egoboost comments, though.
6) Libraries and most used chunk of code should be documented using
phpDocumentator or PHPLint (this latter is mine :-). Every programmer using
these tools should rely on the interface specified in the documentation,
and this documentation should be always available on-line via WEB.

7) Submit your program to a formal validator, as PHPLint.

8) Keep every project under a release version system like CVS. It is really
useful also when there is only one developer.

Best regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it

Closed Thread