Version1: I have this code which works as well:
file_put_contents("../img/avatar/".$id.".jpg", file_get_contents("http://localhost/folder/script.php?id=$id"));
Version2: Now I need to write a path without protocol in file_get_contents
, So here is the new version of my code. But it doesn't work:
$_GET['id'] = $id;
file_put_contents("../img/avatar/".$id.".jpg", file_get_contents("../folder/script.php"));
What's wrong with version2?
Note: script.php
makes a avatar. And version1 creates that image as well but version2 just creates a unknown image.