/
util.php
34 lines (27 loc) · 872 Bytes
/
util.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
function curPageURL() {
$pageURL = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
? 'http'
: 'https';
$pageURL .= "://";
$pageURL .= $_SERVER['HTTP_HOST'];
//$pageURL .= $_SERVER['REQUEST_URI'];
$pageURL .= $_SERVER['PHP_SELF'];
return $pageURL;
}
function urlGET($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
// PHP community - punts the problem down the road
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if(curl_error($ch))
{
echo "<pre>\n".'network error:' . curl_error($ch)."\n</pre>\n";
}
return $response;
}