Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:09:34+00:00 2026-06-12T16:09:34+00:00

There are 2 servers A and B. I have my php script in server

  • 0

There are 2 servers A and B. I have my php script in server B.
Now, the client sends some data to server A and server A sends it to server B.

I want to get the IP address on which the request came(that is server A). How can I do it using php?

If I use $_SERVER['REMOTE_ADDR'], I get the clients IP address.
If I use $_SERVER['SERVER_ADDR'], I get the null value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:09:35+00:00Added an answer on June 12, 2026 at 4:09 pm

    $_SERVER['SERVER_NAME'] and $_SERVER['HTTP_HOST'] should return the DNS name of the server. If you can use the DNS instead of the IP I think maybe you should try with one of these variables. Although, as mentioned earlier, if $_SERVER['SERVER_ADDR'] isn´t populated you probably have a faulty configuration.

    Provide information about server, IIS/Apache, OS, PHP version, it might be easier to help.

    Also, try echoing/logging $_SERVER['SERVER_ADDR'] on server A where the request comes in and see if you get a value from there because reading $_SERVER['SERVER_ADDR'] on server B should give you IP of server B. If you get a value on server A you can save/pass the value forward to server B in code (wherever your transaction from server A to B takes place).

    “The IP address of the server under which the current script is executing.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file stored in the terminal server and there are some inforation
For some reason, I want to serve my robots.txt via a PHP script. I
I have two different servers and a script like this: echo <div style=\some style\>whatever</div>;
I have an Apache server running on a client's computer, with PHP installed. I
Suppose you have two linked servers called Local and Remote respectively. Is there a
I have a project where there are Windows, FreeBSD and Linux servers. I have
I have a server application with such structure: There is one object, call him
I'm have a server application, and there is a single line Certificate[] certs =
Let's say I have a server machine S with a database. There are also
I have an iPhone app out there that calls home to my server every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.