Are there any other kinds of fetching remote data in PHP, except for: "cURL"
and having "allow_url_fopen"
in php.ini set to "On"
, to be able to stream remote content using "fopen"
, "fsockopen"
or "file_get_contents"
?
I'm working on a custom-PHP remote content streamer and I'm looking for any other ways of streaming remote content, if the "cURL"
or "allow_url_fopen"
is "Off"
.
What about running system calls? Like passthru()
or exec()
or system()
and calling curl
or wget
on the command line and capturing the data
Linux Example:
ob_start();
passthru("wget -U 'CustomUserAgent' -q -O - 'http://www.example.com/'");
$output = ob_get_clean();
Windows 7+ Example (through powershell). Taken from here
(new-object System.Net.WebClient).DownloadFile('http://www.example.come','C:\tmp\output.txt') –
To expand on the windows method, see executing a Powershell script from php