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 7981745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:28:11+00:00 2026-06-04T10:28:11+00:00

My server is behind a proxy and I’m trying to get a IP of

  • 0

My server is behind a proxy and I’m trying to get a IP of a user I’m using in PHP

$IP = $_SERVER['HTTP_X_FORWARDED_FOR'];

The problem I see lately some users Ip’s are like this below example Ip’s.

173.0.0.000, 190.000.00.01
173.0.0.000, 190.000.00.02
173.0.0.000, 190.000.00.03
173.0.0.000, 190.000.00.04
173.0.0.000, 190.000.00.05

How would I go about just getting the correct IP like below. It doesn’t happen on all the Ip’s.

  • 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-04T10:28:13+00:00Added an answer on June 4, 2026 at 10:28 am

    The format for X-Forwarded-For is: client1, proxy1, proxy2. So you will want to grab the first address in the list:

    $IP = current(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
    
    echo $IP; // 173.0.0.000
    

    That will grab the first IP address whether there are multiple addresses or just one.

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

Sidebar

Related Questions

I am trying to get ANT and IVY to work behind proxy server. SetProxy
I'm trying to connect R from behind a proxy server. I've tried various versions
I'm calling a method on a web service from behind a proxy server using
I'm having a problem with Maven behind a squid proxy server. I have a
I'm trying to run a XBAP application from behind a proxy server, the first
I have an LCDS server sitting behind a corporate proxy/firewall. I need to use
Server works fine, but the problem is the client doesn't receive anything. server.php <?php
I am trying to access maven repository from behind proxy. I configured settings.xml correctly
I am behind a proxy server and thus I cannot update rvm with rvm
The scenario: You're behind a proxy server on Windows. You've configured TortoiseHg to use

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.