By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,746 Members | 1,849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,746 IT Pros & Developers. It's quick & easy.

Create a listening socket in PHP ?

P: n/a
How does one go about creating a listening socket in a PHP script.

I'm trying to work out a way of finding out my IP address (dynamic,
behind NAT) and I can't use the normal http idea to get it (due to
stuff proxy by ISP).

SO what I thought was to write a protected PHP script which listend for
ONE request on that port - and send back the IP bound on that port.

So from my linux box I would:

1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

127.0.0.1 wrote:
How does one go about creating a listening socket in a PHP script.

I'm trying to work out a way of finding out my IP address (dynamic,
behind NAT) and I can't use the normal http idea to get it (due to
stuff proxy by ISP).

SO what I thought was to write a protected PHP script which listend for
ONE request on that port - and send back the IP bound on that port.

So from my linux box I would:

1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?

Luke

Jul 17 '05 #2

P: n/a
Luke Ross wrote:
1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?


This isn't an e-mail issue ... I want to write a script that runs on my
home linux box that finds out the IP address to send to the DNSMadeEasy
folk and my DDNS entry there.

I'm finding it absolutely amazing that there is no easy way of doing
that... so I am trying out other ways ... including PHP.

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #3

P: n/a
Luke Ross wrote:
Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?


It is a translucent proxy, I don't actually have an IP address for the
proxy in a reliable fashion, and the proxy doesn't reliably pass on my
IP address. Also - the headers will tend to have my private-ip address
in them anyway.... not the public IP which is the one I want to find
out.

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.