-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurl.php
More file actions
48 lines (40 loc) · 1.23 KB
/
curl.php
File metadata and controls
48 lines (40 loc) · 1.23 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?
function curl_get($url){
$c = curl_init();
curl_setopt_array($c, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_COOKIEJAR => getcwd().'/cookiefile.tmp',
CURLOPT_COOKIEFILE => getcwd().'/cookiefile.tmp',
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31'
));
$e = curl_exec($c);
curl_close($c);
return $e;
}
function curl_post($url, $post, $header=false){
$c = curl_init();
curl_setopt_array($c, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_COOKIEJAR => getcwd().'/cookiefile.tmp',
CURLOPT_COOKIEFILE => getcwd().'/cookiefile.tmp',
//CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($post),
CURLOPT_HEADER => 1
));
if($header){
curl_setopt($c, CURLOPT_HTTPHEADER, $header);
}
$e = curl_exec($c);
curl_close($c);
return $e;
}
?>