I need a little help with the fsockopen function.
I have this PHP code:
if (in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554,47830,50070))
|| @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 1))
I need to make fsockopen check IPs by port 80 if it doesn’t request authentication.
I think I should use isset($_SERVER['PHP_AUTH_USER']) in there somewhere, but I can’t do it by myself. Can anyone help?
Update………………………
@drew010 Thank you very much
My Best Regards
To see if the remote server requests authentication, you need to make a request and read the response.
If the response is 401 Authorization Required, then it is requesting auth, otherwise it is not.