26 defined(
'LGV_CHAMELEON_UTILS_CATCHER' ) or die ( 'Cannot Execute Directly' );
43 &$content_failure_note = NULL
48 if (extension_loaded(
'curl')) {
50 if (isset($_COOKIE[
'PHPSESSID']) && $_COOKIE[
'PHPSESSID']) {
51 $strCookie =
'PHPSESSID='.$_COOKIE[
'PHPSESSID'].
'; path=/';
53 session_write_close();
57 $resource = curl_init();
59 if (isset($strCookie)) {
60 curl_setopt($resource, CURLOPT_COOKIE, $strCookie);
65 $spli = explode(
"?", $in_uri, 2);
67 if (is_array($spli) && count($spli)) {
69 $in_params = $spli[1];
71 parse_str($in_params, $temp);
76 $in_params = http_build_query($temp);
78 curl_setopt($resource, CURLOPT_POST,
true);
79 curl_setopt($resource, CURLOPT_POSTFIELDS, $in_params);
84 curl_setopt($resource, CURLOPT_URL, $in_uri);
87 curl_setopt($resource, CURLOPT_RETURNTRANSFER,
true);
93 curl_setopt($resource, CURLOPT_HEADER,
false);
96 curl_setopt($resource, CURLOPT_MAXREDIRS, 3);
99 curl_setopt($resource, CURLOPT_CONNECTTIMEOUT, 10);
102 curl_setopt($resource, CURLOPT_ENCODING,
'gzip,deflate');
105 curl_setopt($resource, CURLOPT_USERAGENT,
"cURL Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20130401 Firefox/21.0 CHAMELEON/BADGER");
108 curl_setopt($resource, CURLOPT_SSL_VERIFYPEER,
false);
111 $content = curl_exec($resource);
114 if (
false === $content) {
116 $content_failure_note =
"curl failure calling $in_uri, ".curl_error($resource).
", ".curl_errno ($resource);
122 $http_status = curl_getinfo($resource, CURLINFO_HTTP_CODE);
126 curl_close ($resource);
129 if (
false !== $content) {
static call_curl( $in_uri, $in_post=false, &$http_status=NULL, &$content_failure_note=NULL)
This is a function that returns the results of an HTTP call to a URI. It is a lot more secure than fi...