I'm trying to send a string like "@mystr"
with php using CURL
POST method but if when I just send with following code:
$url_str = $url->getUrl();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_str);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:multipart/form-data']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$out = curl_exec($ch);
curl_close($ch);
It will throw an error that says:
Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead...
Note: $fields are something like this:
$fields=['chat_id'=>'@someusername','text'=>'hello'];
It's for telegram bot api, if I use %40
instead of @
in GET method it will be ok and telegram will sends my message to my channel, but I have to use POST method.
Is there anyway to send strings starts with @
in CURL ?