I have this folder-structure:
\out
\MakeAvatar.php
\root
\include
\Calculator.php
\img
\avatar
What's MakeAvatar.php
? That's a script which gets a parameter (like id) and makes a avatar based on that parameter. Now I need to pass a argument ($id
) from Calculator.php
to MakeAvatar.php
. How can I do that?
Here is my code:
$_GET['id'] = $id; // passing
file_put_contents("../img/avatar/".$id.".jpg", file_get_contents("../out/MakeAvatar.php"));
But it doesn't work. I mean the result is a unknown-image (unclear).
When I open that image by a editor, it is containing the content of MakeAvatar.php
(all its codes). So it seems the problem is passing.
Note1: If I put MakeAvatar.php
into root and pass that argument like this then if works:
... file_get_contents("http://example.com/MakeAvatar.php?id=$id")
But as you see MakeAatar.php
is out of root and I cannot use http
. So how can I pass an argument without http
?