Hi guys,

I´am trying to send notifications from PHP . I think all it´s ok configured, because i received the screen response.

But i always receive this error:

{"status_code":210,"status_message":"Cannot parse date","response":null}

I have configure the parameter of send_date with multiple values, but always have the same problem:

'send_date' => gmdate("Y-m-d H:i:s") 'send_date' => gmdate("Y-m-d H:i") 'send_date' => 'now' 'send_date' => "now" 'send_date' => "2014-06-13 22:00"

Someone can help to me about this? I have not more ideas where is the problem really on the date format.

Thx you.

asked 12 Jun '14, 23:12
naitronet's gravatar image

naitronet
11113

Try to add additional array surround "notifictions"

$info=array('application' => "MyAppID", 'auth' => "MyAPIToken", 'notifications' => array(array('send_date' => gmdate("Y-m-d H:i"),'content' => 'test','data' => array('custom' => 'json data'),'link' => 'http://pushwoosh.com/')));

permanent link
answered 13 Jun '14, 14:36
XXXX's gravatar image

XXXX
2.2k6

Hello!

Can you provide full API request, plz?

permanent link
answered 13 Jun '14, 13:49
XXXX's gravatar image

XXXX
2.2k6

<?php
define('PW_DEBUG', true);

function pwCall($method, $data) {
$url = 'https://cp.pushwoosh.com/json/1.3/' . $method;
$request = json_encode(array ('request' => $data));

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if (defined('PW_DEBUG') && PW_DEBUG) {
print "[PW] request: $request\n";
print "[PW] response: $response\n";
print "[PW] info: " . print_r($info, true);
}
}

$info=array('application' => "MyAppID",
'auth' => "MyAPIToken",
'notifications' => array('send_date' => gmdate("Y-m-d H:i"),'content' => 'test','data' => array('custom' => 'json data'),'link' => 'http://pushwoosh.com/')
);

pwCall('createMessage',$info);

permanent link
answered 13 Jun '14, 14:08
naitronet's gravatar image

naitronet
11113

[PW] request: {"request":{"application":"MyAPPId","auth":"MyAPIToken","notifications":{"send_date":"2014-06-13 12:30","content":"test","data":{"custom":"json data"},"link":"http:\/\/pushwoosh.com\/"}}} [PW] response: HTTP/1.1 200 OK Server: nginx/1.4.2 Date: Fri, 13 Jun 2014 12:30:55 GMT Content-Type: application/json; charset=utf8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: phpDaemon/1.0-beta3 Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept X-PW-Cluster-Node: api-01 X-PW-Front-Node: front-01 {"status_code":210,"status_message":"Cannot parse date","response":null} [PW] info: Array ( [url] => https://cp.pushwoosh.com/json/1.3/createMessage [content_type] => application/json; charset=utf8 [http_code] => 200 [header_size] => 374 [request_size] => 445 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.276689 [namelookup_time] => 0.078685 [connect_time] => 0.128945 [pretransfer_time] => 0.35993 [size_upload] => 265 [size_download] => 72 [speed_download] => 56 [speed_upload] => 207 [download_content_length] => -1 [upload_content_length] => 0 [starttransfer_time] => 1.275657 [redirect_time] => 0 [certinfo] => Array ( ) )

permanent link
answered 13 Jun '14, 14:09
naitronet's gravatar image

naitronet
11113

Thx you very much !!!

This is the solution to my problem.

Best regards for you.

Very good work.

permanent link
answered 13 Jun '14, 14:47
naitronet's gravatar image

naitronet
11113

You're welcome! =)

permanent link
answered 13 Jun '14, 14:48
XXXX's gravatar image

XXXX
2.2k6

FallDi that worked perfect!

permanent link
answered 15 Jul '14, 21:01
AppBlokes's gravatar image

AppBlokes
11

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×120
×33
×15

question asked: 12 Jun '14, 23:12

question was seen: 2,222 times

last updated: 15 Jul '14, 21:01