Created
October 19, 2020 07:56
-
-
Save fazaio/c4ba7ff056809e84a42b5adc635cb543 to your computer and use it in GitHub Desktop.
Curl Function PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
// ---------------------------------------------------------- | |
// | |
// format function curl($url,$pos,$cookie,$body,$head,$sock) | |
// | |
// ---------------------------------------------------------- | |
function curl($url,$pos,$cookie,$body,$head,$sock){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:61.0) Gecko/20100101 Firefox/61.0"); | |
curl_setopt($ch, CURLOPT_HEADER, $head); | |
curl_setopt($ch, CURLOPT_COOKIE, $cookie); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
//curl_setopt($ch, CURLOPT_PROXY, $sock); | |
//curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); | |
curl_setopt($ch, CURLOPT_NOBODY, $body); | |
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $pos); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
}; | |
function save($name,$res){ | |
$berkas =fopen($name,"a"); | |
fputs($berkas, $res); | |
fclose($berkas); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment