3

i made a project that can only restrict request from internal server (on those machine).

is there any way to check the request come from internal server using php?

something like cron job that can only executed if requested from internal server. if any request from external site, than ignore it.

Jeg Bagus
  • 4,895
  • 9
  • 43
  • 54

1 Answers1

9

You can achieve this on this way

if($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $_SERVER['REMOTE_ADDR'] != '127.0.0.1')
 die('Only internal requests are allowed');
Rosmarine Popcorn
  • 10,761
  • 11
  • 59
  • 89