I try to sent sms with this code
But this work only when i replace $number with a string number like '0306977777777'. I dont know why convert my variable ($number) to a random characters.
$number = '0306977777777'
and i gote this error.
I'm not sure why your code isn't handling the $number correctly, as earlier comments pointed out you need to debug whatever is setting $number.
One thing I did notice though is that with Nexmo you need to send numbers in international format so for Greece the number should be 306977777
without the leading zero otherwise your SMS won't be accepted