PHP file_get_contents doesn't work correctly

sir please help me
my php trying to load json from my side server

$main_URL = “example.com?var1=kasjdhakjsh”;
$json = json_decode(file_get_contents($main_URL),TRUE);

and return
failed to open stream: php_network_getaddresses: getaddrinfo failed:

can you help me
thx

Hi @akiba.goru

Are you using following code?

$main_URL = “example.com?var1=kasjdhakjsh”;
$json = json_decode(file_get_contents($main_URL),TRUE);

You can’t use that. $main_URL must be a valid URL. (like http://000webhost.com)

  • It must have the protocol (The default is file://)
  • Then a valid domain
  • Finally the path relative to domain
1 Like

i’m already used that protocol,
i mean "http://"
the json source from my side server on google apps script

@Supun
THx