$data = ["image" => file_get_contents($URL)];
CURLOPT_POSTFIELDS($curl, $data);
$image = [];
$image['path'] = 'path\tmp\file.jpg';
$image['type'] = "image/jpeg";
$image['name'] = "file.jpg";
$data = ["image" => new CURLFile($image['path'], $image['type'], $image['name'])];
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$text = "Привeт, как делa? (жирные выделил замененные на латинские)";
function detect_unicode($text)
{
$out = "";
$flag = false;
for($i = 0; $i < strlen($text); ++$i)
{
if(mb_check_encoding($text[$i], 'UTF-8') && !preg_match('/([^a-zA-Zа-яА-Я])$/u', $text[$i]))
$out .= "<b>$text[$i]</b>";
else
{
$out .= $text[$i];
$flag = true;
}
}
return $flag ? $out : $text;
}
echo detect_unicode($text);
$file = file('test.txt');
foreach($file as $index => $line)
if(preg_match("/(.*),".$id."/", $line))
unset($file[$index]);
file_put_contents("test.txt", implode('', $file));
function getC($url,$ref) {
$curl = curl_init();
$cookie = 'cookie.txt';
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_REFERER, $ref);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__)."/cookie/".$cookie);
$act = curl_exec($curl);
return $act;
}