Home » Php » php – How get return request curl and paste it in a URL?

php – How get return request curl and paste it in a URL?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have file-A.php where end in this way:

$testo= "L'abbonamento scade il: 25-08-2020 11:32 UTC";
print_r($testo);
return $testo;

then i have file-B.php where i have a function with curl for file-A.php
This function is:

function file_curl(){
 $url_file= "https://file-A.php";

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$url_file);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

 $result= curl_exec($ch);   //esegui la chiamata
 curl_close($ch);

 $url= 'https://api.telegram.org/botxxx/sendMessage?chat_id=xxx&parse_mode=HTML&text='.$result; 
 file_get_contents($url);   
 return $result;
}

that $url and file_get_contentspaste inside Telegram the $result but i don’t know why output is only

L

Why ?

How to&Answers: