Remote Access Available But Local Access Not Available

If I run this command, my login page successfully working.
I added ": 9200", port number not responding anything.
I created an issue on elasticsearch-php github page but nobody wrote an ansver.
I have a mistake too. I did not write properly there.

Yes that's true, Elasticsearch accessible both of machine

Yes, Elasticsearch-PHP working remotly

Yes, I run the same code on both machines. Elasticsearch-PHP working on the remote machine but cannot working on locally.

The reason I run it on the remote machine is just because I was wondering if it works.

Sorry. The right code to use is indeed:

<?php

  $json = file_get_contents("http://10.21.8.146:9200/");
  print_r($json);

So that confirms IMHO that you have a problem with the PHP server itself.
I'm thinking of proxy, firewalls, things like that...

I guess you're right about my problem with the PHP version.
Working elasticsearch machine has PHP version 7.3.27.
Working machine use PHP version 7.2.34
I try to fix PHP problem.

Thank you for supporting