The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-General - Ip address
Discuss Ip address in the PHP Development forum on Dev Shed. Ip address PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 7th, 2013, 02:40 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
PHP-General - Ip address
Hi,
I have domain quinnstheprinters.ie. Iam redirect this domain to quinnstheprinters.com. How can i get the ip address of quinnstheprinters.ie and quinnstheprinters.com Please help
Regards,
Sarath_PHP
|

February 7th, 2013, 02:47 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|

February 7th, 2013, 04:45 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
Ipaddress
Hi friend,
I checked in google, iam getting ip address of quinnstheprinters.com, but not getting ip address of quinnstheprinters.ie.
I used command prompt, for checking ip address of domains.The result is 78.153.212.173 (quinnstheprinters.ie) and 174.123.213.184 (quinnstheprinters.com).
The php code i used:
1 : In the case of quinnstheprinters.com
<?php
$IPaddress = $_SERVER['SERVER_ADDR'];
echo $IPaddress;
?>
Result is : 174.123.213.184
2 : In the case of quinnstheprinters.ie
<?php
$IPaddress = $_SERVER['SERVER_ADDR'];
echo $IPaddress;
?>
Result is : same as quinnstheprinters.com
How can i get ip address of quinnstheprinters.ie?
Regards
Sarath_PHP
|

February 7th, 2013, 04:50 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
Hi Jacques1,
I checked in google, iam getting ip address of quinnstheprinters.com, but not getting ip address of quinnstheprinters.ie.
I used command prompt, for checking ip address of domains.The result is 78.153.212.173 (quinnstheprinters.ie) and 174.123.213.184 (quinnstheprinters.com).
The php code i used:
1 : In the case of quinnstheprinters.com
<?php
$IPaddress = $_SERVER['SERVER_ADDR'];
echo $IPaddress;
?>
Result is : 174.123.213.184
2 : In the case of quinnstheprinters.ie
<?php
$IPaddress = $_SERVER['SERVER_ADDR'];
echo $IPaddress;
?>
Result is : same as quinnstheprinters.com
How can i get ip address of quinnstheprinters.ie?
Regards
Sarath_PHP
|

February 7th, 2013, 06:13 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
It's not possible -- at least there's no reliable way to do it with your current setup.
What this "redirect" actually does is tell the user's browser that the page is now at a different location. The browser will then typically request the page at the new location. But there's no connection between the two request. There's no information about the original page (like the referrer).
What you could do is append this information to the new URL:
PHP Code:
header('Location: http://quinnstheprinters.com?origin=ie');
But I'm pretty sure that's not what you want.
You'll need a more advanced technique like a proxy to keep the information about the original page. But I'm no expert on that topic.
|

February 10th, 2013, 10:50 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
hi Jacques1,
Thanks for your reply.
|

February 12th, 2013, 03:03 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
Hi Jacques1,
Actually i didn't get the result so i was add another post. So please let me know, do i need to host quinnstheprinters.ie as seperate website.
|

February 12th, 2013, 10:39 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
I gave you two possibilities: Either you use a URL parameter to pass information about the original site, or you set up a proxy (and use the X-Forwarded-For header field to get the original IP).
Which one you use is up to you. If you go with the proxy, I cannot help you, because I don't know how exactly that works. Read that up yourself and use the Apache forum if there's something you don't understand.
|

February 13th, 2013, 03:20 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 20
Time spent in forums: 6 h 11 m 46 sec
Reputation Power: 0
|
|
|
Hi Jacques1,
Thank u so much, i got it. I use URL parameter.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|