Attempts to fetch data from a URL, regardless of PHP's allow_url_fopen setting.


void fetch_web_data (string $url[, string $post[, bool $keep_alive]])

Parameter $url

Expected type: String
Description: The URL to get data from. Must begin with http://, https://, ftp:// or ftps://

Parameter $post

Expected type: String
Description: POST data to send to the remote server (uses GET otherwise)

Parameter $keep_alive

Expected type: Boolean
Description: If true, sends a "Connection: Keep-Alive" command to the server, telling it to wait for more instructions. Otherwise the connection is closed once the information has been sent/recieved. Default is false.


  • Can fetch data from an FTP URL
  • Won't work if fsockopen or fwrite are disabled.
  • When connecting via FTP, attempts to connect in passive mode and dies if it can't
  • Supports secure FTP (ftps) and HTTP (https)
  • Returns the data that was fetched