Reputation:
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"
.
Upvotes: 1
Views: 266
Reputation: 533
"allow_url_fopen" does not affect "fsockopen".
Even if it did, having system calls enabled in a webserver is a security threat bigger than having "allow_url_fopen=On".
To disable fsockopen, it can be added to "disable_functions" in php.ini
Upvotes: 1
Reputation: 10547
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
Upvotes: 1