473,804 Members | 3,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("Msxml2.Se rverXMLHTTP.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.XMLHt tpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest( );
} else if(window.Activ eXObject) {
// Internet Explorer 5+
req = new ActiveXObject(" Microsoft.XMLHT TP");
} 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.CreateOb ject("Msxml2.Se rverXMLHTTP.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 3268
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.so urceforge.net> a écrit dans le message
de news: dv**********@ik aria.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_comp lete, "r"))
echo 'ok';
else
echo 'ko';

I also tried several syntax with the fsockopen (ssl://...) but i always
obtain :
Warning: fsockopen(): php_network_get addresses: 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************* ********@z34g20 00...legro ups.com...
What exactly did you try and what kind of "no result" have you achieved
(error messages, etc.)?
if ($handle = fsockopen('http s://myserver:4012/code/param?', 80, $errno,
$errstr))...
or
if ($handle = fsockopen('http s://myserver:4012/code/param?', 4012, $errno,
$errstr))...
or
if ($handle = fsockopen('http s://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************* ********@z34g20 00...legro ups.com...
What exactly did you try and what kind of "no result" have you achieved
(error messages, etc.)?


if ($handle = fsockopen('http s://myserver:4012/code/param?', 80, $errno,
$errstr))...
or
if ($handle = fsockopen('http s://myserver:4012/code/param?', 4012, $errno,
$errstr))...
or
if ($handle = fsockopen('http s://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************* ********@j33g20 00...legro ups.com...
<But of course it didn't work... Have you even looked at fsockopen()
<documentatio n? 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
10154
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 any references to it in the official PHP documentation (many times in the user contributed notes, though). Often, undocumented features go away with future releases, since "nobody should have been using them anyway," etc. For this reason I am...
5
13682
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 site requires to get form data from web client and to convert the data with XML format and send the data to another web site which only accepts https protocol. If my site needs to receive information from the remote
18
9471
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 src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'> However when I click on the button (under Win2000 + IE5.5) no window pops up. Why?
2
1355
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 "https://mywebsite.com:5004/" the application errors out when the request stream is closed. Error "Cannot access a disposed object - System.Net.TLSStream". Any one have a solution or work around? Thanks.
1
2943
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 to http: instead of https:. our CSS is https://vose.ebiz.verizon.com/voseapp/Tpv.axms?wsdl When adding this reference, the wsdl generated shows: <port name="TPVSoap" binding="s0:TPVSoap"> <soap:address...
0
1349
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 AJAX enabled. For example, at the same website where I uploaded the control assembly, I also posted some tutorials on how to use this AJAX container control. One of the tutorials walks you through the steps to create an AJAX chat application. You...
1
4135
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): self.ftp = ftplib.FTP(hostname) self.ftp.login(username,password) self.ftp.set_pasv(False)
1
5355
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 credit card info 3. Confirmation. I'm handling the different steps with AJAX. So, you land on an https page that has you enter your personal info and click continue. An ajax request is performed and the data is saved to the server, and the credit...
5
3304
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 the timeline. Simile Timeline uses DHTML and AJAX. Any suggestions? Sample of code: <data> <event start="Jun 02 2008 09:00:00 GMT" end="Aug 02 2008 16:00:00 GMT" isDuration="true" title="Internship at LMC"...
0
9706
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
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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
10335
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
10323
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
7621
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
6854
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
5525
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...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.