473,396 Members | 1,998 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,396 software developers and data experts.

Open a https url on a special port ? (asp/ajax inside)

Hi,

I'm trying to translate an asp application in a php way, i'm using Php
4.3.x.
I'm going to try an asp newsgroup too, but as it mainly deals with Php, I
would like to submit you my probem :

I have to retrieve some XML datas from a server whose URL is built like that
:
https://myserver:4012/code/myapp?param1=3;

I tried fopen, fsockopen with no result.

So it's https, there is a port (4012 for example). Perhaps I forgot some
particular https parameters with my fopen and fsockopen tries ?

The original asp code is :
---
Set myxml = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
' Opens the connection to the remote server :
xml.Open "GET", url, False
---

Php methods didn't work so I tried the ajax way :
if(window.XMLHttpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert('Problem creating the XMLHttpRequest object');
return false;
}
return req;

.... But i'm not sure the ActiveXObject is identical to the original :
Set myxml = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")

So if you have any ideas to do it with Php or any other technical ways, you
are welcome.

Thanks,
Arnaud

Mar 17 '06 #1
6 3240
On 2006-03-17, Arnaud <no> wrote:
I'm trying to translate an asp application in a php way, i'm using Php
4.3.x.
[snip asp code]
So if you have any ideas to do it with Php or any other technical ways, you
are welcome.


And where is the code that you've already tried but didn't work?

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Mar 17 '06 #2
NC
Arnaud wrote:

I have to retrieve some XML datas from a server whose URL is built like that
:
https://myserver:4012/code/myapp?param1=3;

I tried fopen, fsockopen with no result.


What exactly did you try and what kind of "no result" have you achieved
(error messages, etc.)?

Also, have you tried cURL?

Cheers,
NC

Mar 17 '06 #3

"Tim Van Wassenhove" <ti***@users.sourceforge.net> a écrit dans le message
de news: dv**********@ikaria.belnet.be...
On 2006-03-17, Arnaud <no> wrote:
And where is the code that you've already tried but didn't work?


Classical fsockopen or fopen :
if ($handle = fopen($url_complete, "r"))
echo 'ok';
else
echo 'ko';

I also tried several syntax with the fsockopen (ssl://...) but i always
obtain :
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or
service not known (is your IPV6 configuration correct? If this error happens
all the time, try reconfiguring PHP using --disable-ipv6 option to
configure) in...

Arnaud
Mar 17 '06 #4

"NC" <nc@iname.com> a écrit dans le message de news:
11*********************@z34g2000cwc.googlegroups.c om...
What exactly did you try and what kind of "no result" have you achieved
(error messages, etc.)?
if ($handle = fsockopen('https://myserver:4012/code/param?', 80, $errno,
$errstr))...
or
if ($handle = fsockopen('https://myserver:4012/code/param?', 4012, $errno,
$errstr))...
or
if ($handle = fsockopen('https://myserver/code/param?', 4012, $errno,
$errstr))...
Also, have you tried cURL?


Not yet, but i'm looking at it, i can see in my phpinfo :
CURL support enabled
CURL Information libcurl/7.12.2 OpenSSL/0.9.7d zlib/1.1.4

thanks,
arnaud
Mar 17 '06 #5
NC
Arnaud wrote:
"NC" <nc@iname.com> a écrit dans le message de news:
11*********************@z34g2000cwc.googlegroups.c om...
What exactly did you try and what kind of "no result" have you achieved
(error messages, etc.)?


if ($handle = fsockopen('https://myserver:4012/code/param?', 80, $errno,
$errstr))...
or
if ($handle = fsockopen('https://myserver:4012/code/param?', 4012, $errno,
$errstr))...
or
if ($handle = fsockopen('https://myserver/code/param?', 4012, $errno,
$errstr))...


But of course it didn't work... Have you even looked at fsockopen()
documentation? Check it out:

http://www.php.net/fsockopen

The correct usage of fsockopen() in your case would be something like
this:

$host = 'myserver';
$port = 4012;
$path = 'code/myapp?param1=3';
$fp = fsockopen($host, $port, $errno, $errstr);
if ($fp) {
fputs($fp, "GET $path HTTP/1.0\r\n");
fputs($fp, "Host: $host\r\n\r\n");
} else {
die ("Could not connect to $host on port $port: error $errno
($errstr)");
}
$data = '';
while (!feof ($fp)) {
$data .= fgets ($fp, 10240);
}
fclose ($fp);

Now $data should contain the entire HTTP response, including HTTP
headers...

Cheers,
NC

Mar 17 '06 #6
<"NC" <nc@iname.com> a écrit dans le message de news:
11*********************@j33g2000cwa.googlegroups.c om...
<But of course it didn't work... Have you even looked at fsockopen()
<documentation? Check it out:
<http://www.php.net/fsockopen
<The correct usage of fsockopen() in your case would be something like
<this:
<$host = 'myserver';
<$port = 4012;
<$path = 'code/myapp?param1=3';
<$fp = fsockopen($host, $port, $errno, $errstr);
<[...]
<Now $data should contain the entire HTTP response, including HTTP
<headers...

Hi,
Yes, I tried that way too, but it didn't work either, the problem was a bad
ip, it's resolved now.
Thanks for your time and help.

Arnaud
Mar 20 '06 #7

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

Similar topics

4
by: Joshua Beall | last post by:
Hi All, I've seen many references to the $_SERVER variable, which is set to the string 'on' when the client is connected via HTTPS rather than regular HTTP. However, I have been unable to find...
5
by: John Xu | last post by:
I have a question regarding https and SSL between two web sites. I am not quit understand how asp application can handle https, encryption and SSL. Here is scenario: An asp application on my web...
18
by: Wladimir Borsov | last post by:
Inside a html page (more precicesly inside a JSP page) I defined a button. When the user clicks this button a second browser window should pop up und load the passed URL. I coded <img...
2
by: Bill W. | last post by:
I have a VB.NET application that needs to make a web request using the https protocol, but not on the standard https port. It works fine on the standard https port, but as soon as the uri becomes...
1
by: Tim Reynolds | last post by:
We use CSS in our staging environment to load balance calls to our web services. However, when adding a web reference to a basic C# .Net windows app, the wsdl & reference.cs generated both point...
0
by: LeProgrammeur | last post by:
Hi guys! I created a control that works like an AJAX container. Basically the way it works is that all the ASP.NET controls that you place inside of the AJAX container will automatically become...
1
by: Laszlo Nagy | last post by:
Hi All, I'm using a simple program that uploads a file on a remote ftp server. This is an example (not the whole program): def store(self,hostname,username,password,destdir,srcpath):...
1
gregerly
by: gregerly | last post by:
I've got a question regarding how AJAX calls are handled over HTTPS pages. On my site, I've got a signup form that collects credit card info. It's a three part form, 1. Enter personal Info 2. Enter...
5
by: doublestack | last post by:
Hi everyone, I have a xml file that Simile Timeline uses to call events...Some of the events have links in them and I need to have those links open a new window. As it stands now the links replace...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.