sending message in telegram bot using curl
<p>I want to get my bot message from database and send to the user, It worked when my text was only 1 word,but now it doesn't work and shows the HTTP BAD REQUEST 400. I think I should use curl, but I didn't find any document useful for sending a long message from telegram bot.(actually because I'm a beginner in php)</p>

<p>here is my code
    

<pre><code>$botToken="something";
$website="https://api.telegram.org/bot".$botToken;


$update = file_get_contents("php://input");
$update = json_decode($update, true);

$chatID = $update["message"]["chat"]["id"];
$message = $update["message"]["text"];

define("dbhost", "localhost:3306"); define("dbuser", "sm");
define("dbpass", "sm"); define("database", "sm");

switch ($message){
 case "/get":
  connected($chatID);

break;

 }

function sendMessage($chatID,$message){


$url =$GLOBALS[website]."/sendMessage?chat_id=".$chatID."&amp;text=".$message;

//file_get_contents($url);
    $ch = curl_init(); 

    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

    $output = curl_exec($ch);
    curl_close($ch);

   //checkJSON($chatID,$update);

 }

 function connected($chatID){

 $conn = mysql_connect(dbhost,dbuser,dbpass);

 if(! $conn )
 {
   die('Could not connect: ' . mysqli_error());
 }


  mysql_select_db( database );

  $strSQL = "SELECT text FROM bott WHERE id= '1' ";
  $result = mysql_query($strSQL) or die('SQL Error :: '.mysql_error());
   $row = mysql_fetch_assoc($result);
  $message=$row['text'];
  sendMessage($chatID,$message);
  mysql_close($conn);
  }




function checkJSON($chatID,$update){

    $myFile = "log.txt";
    $updateArray = print_r($update,TRUE);
    $fh = fopen($myFile, 'w') or die("can't open file");
    fwrite($fh, $chatID ."\n\n");
    fwrite($fh, $updateArray."\n\n");
    fclose($fh);
  }




?&gt;
</code></pre>

<p>this is the error when I use file_get_contents</p>

<pre><code>[08-Jul-2016 12:27:35 America/Chicago] PHP Warning:     file_get_contents(https://api.telegram.org/bot218048829:AAF7baKISagQfALp4OIPh-   yU_hMOnpFGU0A/sendMessage?   chat_id=98506693&amp;amp;text=Introduction%0D%0AA+COMPUTER+PROCESSOR+such+as+Intel%92s+i486+used+to+cost+around+the+same+as+a+small+car.+Nowadays+a+chip+with+similar+power+is+the+price+of+a+chocolate+bar.%0D%0A): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
 in /home/sfduiir1/public_html/php.php on line 29
</code></pre>

<p>This code doesn't send anything to the user.</p>