Forum Moderators: coopster

Message Too Old, No Replies

IP Questing about Posting Data

Will this be viewed as coming from my server or the user's ip?

         

zigx

9:47 pm on Sep 10, 2004 (gmt 0)

10+ Year Member



I would like to use this function

<?
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";

$urlencoded = "";
while (list($key,$value) = each($vars))
$urlencoded.= urlencode($key) . "=" . urlencode($value) . "&";
$urlencoded = substr($urlencoded,0,-1);

$content_length = strlen($urlencoded);

$headers = "POST $url HTTP/1.1
Accept: */*
Accept-Language: en-au
Content-Type: application/x-www-form-urlencoded
User-Agent: $user_agent
Host: $server
Connection: Keep-Alive
Cache-Control: no-cache
Content-Length: $content_length

";

$fp = fsockopen($server, $port, $errno, $errstr);
if (!$fp) {
return false;
}

fputs($fp, $headers);
fputs($fp, $urlencoded);

$ret = "";
while (!feof($fp))
$ret.= fgets($fp, 1024);

fclose($fp);
return $ret;
}
?>

in order to automate a few tasks for people who use my script.

My question is does this post come from my server's IP or the user who is utilizing the script?

thanks!

[edited by: jatar_k at 9:56 pm (utc) on Sep. 10, 2004]
[edit reason] removed url [/edit]

Zipper

10:24 pm on Sep 10, 2004 (gmt 0)

10+ Year Member



server's ip

zigx

2:08 am on Sep 11, 2004 (gmt 0)

10+ Year Member



thanks for the edit.

Is there any way i can change it to be the user's IP?

Im thinking maybe a submit button that pops a window or takes to a new page? ne ideas?

thanks very much!

Zipper

6:19 am on Sep 11, 2004 (gmt 0)

10+ Year Member



fsockopen is a php network function that opens a socket connection. php runs at server-side so the server acts as the client in this case. If you need to hide your ip, you can use a proxy. The only way to make the User's IP avialable witin the request is to run the process in the client-side (browser). I'm not aware of any distinct way to accomplish this. however, FYI the html source is accessible thru - "view-source:http://domain.com"