Page 1 of 1

To which IP does an Http request from a PHP script resolves?

Posted: Sun Jul 09, 2006 2:38 am
by hombredecalle
Hello,

Kinda simple question that I'm stuck with.

I have a PHP script that calls an external (3rd party - not mine) ASP service and stores the response in a simple string.

Here the code:

Code: Select all

$url = "http://www.someserver.com/service.aspx?p1=x&p2=y";
$xmlResponse = file_get_contents($url);
The problem
I need that the call for this "service.aspx" will originate from my server IP, NOT from my private user IP. This is because this service has IP restriction and is cofigured to work only if requested from my server IP.

At the moment - any invokation of "service.aspx" shows that the referral IP is my private IP.

How can I make a simple http request that will originate from my server IP, and not from the user's IP ?

Would be glad for any lead here... 8)

Posted: Sun Jul 09, 2006 4:21 am
by jamiel
As far as I know, file_get_contents should originate from your servers IP. But take a look at the curl functions anyways. http://php.net/curl

Posted: Sun Jul 09, 2006 5:35 am
by hombredecalle
Hi,

thanks for the answer.
I would have thought that too, but from the response I get, seems like it isn't the server IP.

Would u recommend using the Curl functions?