0

I'm trying to send some data to Dashing which is a dashboard application. To do this you have to CURL for example.

url -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://127.0.0.1:3030/widgets/welcome

This will update the widget,

I'm just wondering how to do effectively this via PHP?

This is what I have now

$url = 'http://127.0.0.1:3030/widgets/welcome';
$fields = array(
            'auth_token' => "YOUR_AUTH_TOKEN",
            'text' => "ssssssssssss"
        );
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
echo $result;

//close connection
curl_close($ch);

This doesn't work, how would I sent this string?

Thanks,

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.