473,791 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1464
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.ne twrote:
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...@Heineken2 000.de
wrote:
On 28 Jan., 22:26, Joachim Mæland <jm-n...@profine.ne twrote:
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.ne twrote:
>>
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.POISTAT AMA.pulkki...@P OISTATAMA.elisa net.fiwrote:
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************ *************@P OISTATAMA.elisa net.fiwrote:
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
1736
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 fopen(). My question is: are there other ways to read this page? Or is it technically impossible?
12
15578
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 the form using VBscript? Terry <% ' ... some asp processing
3
14050
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 enter the absolute url like response.redirect("https://myProductionServer.com/SecurePage.aspx"), because when Im working in the development server I would have to change it back and forth everytime. Is there an easy way to do this without having...
2
1772
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 <configuration><system.web><customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/></sytem.web></configuration and on the server side, the errors were access denied to "C:\WebFiles\web.config". Failed to start monitoring file...
7
2603
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 PDF" and the current page magically becomes a PDF file. This worked great until we moved the site to https. Now, when the button is clicked, I get a warning that This page contains both secure and nonsecure items. Do you want to display the...
6
4274
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 avoid a "page cannot be displayed". All other interaction with the application works well.
6
4904
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 the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
2
1524
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: http://xxxdomain.com/index.html, then customer decides to buy something from our site. Then our program will provide an absolute path like this: https://xxxdomain.com/buy.asp. Recently I am doing migration and feel that the absolute path is not...
0
1467
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) m_xmld = New XmlDocument m_xmld.XmlResolver = Nothing m_xmld.Load(strFileName) Where strFileName is somthing like "https://www.x.net/aaa.xml"
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.