I'm trying to use wget to read a url into a variable. Below is the code I man using.
When I execute this code from my browser, wget returns a return code of 1. If I login to my server and enter the wget string at the command prompt it works fine. But when executed by apache through the passthru command it fails.
I think it has something to do with the --header I am trying to pass because if I remove that from the command then it doesn't get the return code of 1 and reads the file. But for what I really want returned I need to pass the cookie value as a header.
Any help would be appreciated.
John
<?php
$datastring = passthru("wget -O - --user-agent=Mozilla --header='Cookie: a=b' http://xxxxxxxx:xxxxxxxx@www.mysite.com/file.htm",$retval);
echo "RetVal=",$retval,"<br>";
echo $datastring;
?>