Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify Content-Type Header for Curl request with postMessage #80

Open
buttflattery opened this issue Apr 18, 2018 · 0 comments
Open

Specify Content-Type Header for Curl request with postMessage #80

buttflattery opened this issue Apr 18, 2018 · 0 comments

Comments

@buttflattery
Copy link

buttflattery commented Apr 18, 2018

i could not find any source of setting the Content-Type headers for the curl call against the postMessage() function, previously i used to post messages using native curl like below with json data for curl POSTFIELDS option

$data = array(
            'messages' => array(
                array(
                    'body' => array(
                        'lead'=>1245121542124
                    ),
                    'delay' => intval($delay),
                ),
            ),
 );

$url = 'https://mq-kv-aws-us-east-1-1.iron.io/3/projects/' . $projectKey . '/queues/' . $queue . '/messages';
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Authorization: OAuth ' . $this->token,
                'Content-Length: ' . strlen($data))
            );

            $result = curl_exec($ch);

            curl_close($ch);

But i couldnt find any option to specify the Content-Type : application/json when sending data to the postMessage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant