Why not create a VK post, if you set the text with spaces?

Tellingly, if the space replaced by a hyphen ('Header-image'), then the code works.
$text = 'Caption';

April 4th 20 at 13:02
1 answer
April 4th 20 at 13:04
Due to the necessity of the message encoding.
Space refers to special characters that are encoded.
Such as a space as %20.
urlencode is what You need.

Find more questions by tags PHPVKontakte