| 
	
 | 
 Posted by NC on 08/28/07 18:01 
On Aug 27, 3:13 am, Pugi! <pugin...@gmail.com> wrote: 
> 
> For obtaining the contents of a file one can use the 
> file_get_contents function. 
 
Yes, but one must also remember that in programming, one gets exactly 
what one asks for. :) 
 
> But when I try to use this function to get the contents of file 
> including a querystring I always get a failed to open stream, no such 
> file or directory. 
> $str = file_get_contents('/dir1/dir2/dir3/file.php? 
> param1=12¶m2=log¶m3=5'); 
 
But of course.  You are asking for a local file, but append a query 
string to the name.  If you want to get the output of a local script, 
you should ask properly: 
 
$str = file_get_contents('http://localhost/dir1/dir2/dir3/file.php?' . 
  . 'param1=12¶m2=log¶m3=5'); 
 
> The contents of the file can either be text or json encoded. 
> For an xml response it works $xml->load('/dir1/dir2/dir3/file.php? 
> param1=12¶m2=log¶m3=5'). 
 
Well, which XML parser class are you using?  It's possible that the 
parser class you are using treats the argument to the load() method as 
a URL... 
 
Cheers, 
NC
 
  
Navigation:
[Reply to this message] 
 |