473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Reading a page with file() - Problems with https

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.

Jan 28 '07 #1
8 1449
On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
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?
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.
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.

Jan 28 '07 #2
..oO(Cord-Heinrich Pahlmann)
>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?
>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
Jan 28 '07 #3


On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
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.
>
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.

Jan 28 '07 #4
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:
On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
On Sun, 28 Jan 2007 12:20:25 -0800, Cord-Heinrich Pahlmann wrote:
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.


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.
Jan 29 '07 #5
On Sun, 28 Jan 2007 14:34:09 -0800, Cord-Heinrich Pahlmann wrote:
On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.netwrote:
>>
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.
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>
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.

Jan 29 '07 #6
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.

Jan 29 '07 #7


On 29 Jan, 13:40, "P Pulkkinen"
<perttu.POISTATAMA.pulkki...@POISTATAMA.elisanet.f iwrote:
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?

Jan 29 '07 #8
"P Pulkkinen" <pe*************************@POISTATAMA.elisanet.f iwrote:
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

Jan 29 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wim Roffil | last post by:
Hi, I have a screencraper application that read webpages with fopen() and then processes them. Now I found a https page that does not require a password. However, I cannot read it with...
12
by: Terry | last post by:
I'm trying to automatically submit a form to another ASP page after some <input> fields values are filled by ASP. I know I can do it using javascript, but is there a way to automatically submit...
3
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to...
2
by: kl | last post by:
Hello My aspx pages run fine with non-secure server. When I tried to run them with https://, on the browser side, the runtime error occurred with suggestions of adding the following configuration...
7
by: Ryan Taylor | last post by:
Hi. I have some code that dynamically generates a PDF and spits this content directly to the web browser. I use HTMLDoc to create the Pdf's from html. So the user can click on a button "Print...
6
by: chris | last post by:
Client page: <input type="file".....> Server: Apache, OC4J, J2EE app XP, SP1 and updates Works perfectly under HTTP. However, under HTTPS the user needs to hit the submit button really fast to...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, What is the best way to lead customer from a regular page to a secured page? Regularly, we use absolute path. say first ,a customer is on this regular page for general information:...
0
by: philipdv | last post by:
I have a process reading xml files over an https connection My code to read this xml file is CErrorAndLog.LogAlways("CKlim", "parseXML", "Parsing XML file: " + strFileName) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.