Files
wizzardRedux/includes/functions.php
Matt Nadareski d3acae2ed7 Cleanup
This is a bulk cleanup of all of the functions that have since been
surpassed by their desktop counterparts. A lot of effort went into these
original features but the effort that was expended to make the desktop
better far exceeded this. I thank the efforts of everyone who helped to
make the web version a reality in the first place since it provided the
strong base that SabreTools has become. This will still be maintained
purely as a way of checking files online as will be required when the
WoD DATs are properly recreated.
2016-07-28 11:02:20 -07:00

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;
}
?>