Merhaba aşağıda ki kod kısmında buna sebep olan nedir bu kodu daha kullanılır halle nasıl getirebilirim
public function DownloadImage($url,$ImageName = false){
$file = explode('/',$url);
$count = count($file);
$fileName = $file[$count - 1];
$fileDotExpo = explode(".",$fileName);
$fileExt = $fileDotExpo[count($fileDotExpo) - 1];
$fileNameWithoutExt = str_replace(".".$fileExt,"",$fileName);
if($fileExt != "gif" &&
$fileExt != "tif" &&
$fileExt != "tiff" &&
$fileExt != "bmp" &&
$fileExt != "jpeg" &&
$fileExt != "jpg" &&
$fileExt != "png"
){
return "";
}
if($ImageName != false){
$fullfilename = $this->sef($ImageName)."-".rand(0,100000).".".$fileExt;
}else{
$fullfilename = $fileNameWithoutExt."-".rand(0,100000).".".$fileExt;
}
$SaveFilePath = dirname(__FILE__)."./../".$this->WEBSITE_STORAGE_DIRECTORY."/".$fullfilename;
if (!extension_loaded(curl)) {
/* curl kurulu değil file_get_contents ile adresi okuyalım */
$data=file_get_contents($url);
}else{
$ch = curl_init("$url");
if (!$ch) {
die("Curl bu adres'e bağlanamadı.");
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
}
$saveFile=file_put_contents($SaveFilePath, $data);
$SaveFileUrl = $this->WEBSITE_URL."/".$this->WEBSITE_STORAGE_DIRECTORY."/".$fullfilename;
return $SaveFileUrl;
}
public function sef($s) {
$tr = array('ş','Ş','ı','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç');
$eng = array('s','s','i','i','g','g','u','u','o','o','c','c');
$s = str_replace($tr,$eng,$s);
$s = strtolower($s);
$s = preg_replace('/[^%a-z0-9 _-]/', '', $s);
$s = preg_replace('/s+/', '-', $s);
$s = preg_replace('|-+|', '-', $s);
$s = trim($s, '-');
return $s;
}
public function Post($clientDomainName,$clientDomainCode,$Process,$jsonData = ''){
$EncodingAlgoritmhs = array("MD5","SHA1","SHA256","SHA512","SHA1");
$NowEncodingAlgorithm = $EncodingAlgoritmhs[rand(0,(count($EncodingAlgoritmhs)-1))];
$clientDomainCode = hash($NowEncodingAlgorithm, $clientDomainCode);
$post = [
'data' => $jsonData ,
'auth' => array("code"=>$clientDomainCode,"encoding"=>$NowEncodingAlgorithm),
"process" => $Process,
];
$payload = json_encode($post,true);
$ch = curl_init("https://www.$clientDomainName/sbot/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
curl_setopt($ch, CURLOPT_USERAGENT, "SMedyanAutoPoster/v1");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
// execute!
$response = curl_exec($ch);
$last = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// close the connection, release resources used
curl_close($ch);
// do anything you want with your response
$JsonData = $response;
$JsonData = json_decode($JsonData,true);
return $JsonData;
}