Saturday, 17 August 2013

PHP - Messages containing @-sign can not be send

PHP - Messages containing @-sign can not be send

By trying to send a text via PHP and cURL that contains an @-sign, the
message doesn't get delivered and there are no error messages. What could
be the reason for that?
PHP code:
$postMessage = '@hello world lorem ipsum dolor';
$authToken = "12345";
$postData = array(
'kind' => 'blogger#post',
'blog' => array('id' => $blogID),
'title' => $postTitle,
'content' => $postMessage
);
$ch =
curl_init('https://www.googleapis.com/blogger/v3/blogs/'.$blogID.'/posts/');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer '.$authToken,
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));
$response = curl_exec($ch);
Server info:
PHP Version: 5.3.18-nmm1
cURL Information: 7.19.7
Thank you.

No comments:

Post a Comment