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,

0 Answers0