This may sound like a duplicate question. That is only because, none of the others could get my code working.
My problem code
$file="blog?blogid=$_GET[blogid]";
$contents = file_get_contents(urlencode($file));
I have tried
$file=__DIR__ ."blog?blogid=$_GET[blogid]";
$contents = file_get_contents(urlencode($file));
Both return the error
Warning: file_get_contents(blog%3Fblogid%3D1): failed to open stream: No such file or directory in....
and
Warning: file_get_contents(C%3A%5CProgram+Files%5CEasyPHP-DevServer-14.1VC11%5Cdata%5Clocalweb%5Cmatrimonyblog%3Fblogid%3D1): failed to open stream: No such file or directory in C....
respectively
But they work when I remove the query parameter
?blogid=$_GET[blogid]
from the end of the file.
Just cannot understand what could be the problem
EDIT :
The purpose of using file_get_contents on a file system is to first generate output from that file using a GET parameter and then writing that output to another file.
$fh=fopen($page,'w+');
$fw=fwrite($fh,$contents);
header("location:$page");
Basically I am trying to create a page each for each blog post as it is submitted.
There could be better ways to to do that, But this is what came to my limited knowledge.
Thanks in advance for all help