Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _curl($url, $post = false, $header = array(), $header_out = false, $follow_loc = true) {
- global $ckfile;
- $ch = curl_init();
- if ($post) {
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, $header_out);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $follow_loc);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- if (!is_array($header)) {
- $header = (array) $header;
- }
- $headers = array(
- 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
- 'Connection: Keep-Alive'
- );
- $headers = array_merge($headers, $header);
- $headers_j = array(
- 'Content-Type: application/json; charset=UTF-8',
- 'Connection: Keep-Alive'
- );
- $headers_j = array_merge($headers_j, $header);
- json_decode($post);
- if (json_last_error() == JSON_ERROR_NONE) {
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_j);
- } else {
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_COOKIESESSION, $ckfile);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
- curl_setopt($ch, CURLOPT_COOKIE, $ckfile);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
- //curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
- $result = curl_exec($ch);
- //echo curl_error($ch);
- curl_close($ch);
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement