mirror of
https://github.com/SabreTools/wizzardRedux.git
synced 2026-02-20 13:59:22 +00:00
43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*------------------------------------------------------------------------------------
|
|
House all miscellaneous helper functions
|
|
Original code by Matt Nadareski (darksabre76)
|
|
-----------------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an
|
|
* array containing the HTTP server response header fields and content.
|
|
*
|
|
* @link http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl
|
|
* @link http://stackoverflow.com/questions/4372710/php-curl-https
|
|
*
|
|
* @param $url
|
|
*/
|
|
function get_data($url)
|
|
{
|
|
$options = array(
|
|
CURLOPT_RETURNTRANSFER => true, // return web page
|
|
CURLOPT_HEADER => false, // don't return headers
|
|
CURLOPT_FOLLOWLOCATION => true, // follow redirects
|
|
CURLOPT_ENCODING => "", // handle all encodings
|
|
CURLOPT_USERAGENT => "spider", // who am i
|
|
CURLOPT_AUTOREFERER => true, // set referer on redirect
|
|
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
|
|
CURLOPT_TIMEOUT => 120, // timeout on response
|
|
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
|
|
CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
|
|
);
|
|
|
|
$ch = curl_init( $url );
|
|
curl_setopt_array( $ch, $options );
|
|
$content = curl_exec( $ch );
|
|
$err = curl_errno( $ch );
|
|
$errmsg = curl_error( $ch );
|
|
$header = curl_getinfo( $ch );
|
|
curl_close( $ch );
|
|
|
|
return $content;
|
|
}
|
|
|
|
?>
|