0

I have a dashboard which I post data to display on.The dashbaord has multiple segments. I have an sql query which retrieves the data and loops through to push results. I want run the curl command below via php within this script. Can someone point me in the right direction? Or help. I have looked around a bit but im confused on how to get it to work.

Below is the what my php page will generate and this is what i would like to send via php using curl.

    curl -d '{ "auth_token" : "YOUR_AUTH_TOKEN" , "value" : "519" }' http://172.21.4.62:3030/widgets/Skin
0

2 Answers 2

1

Try without any additional classes:

   $ch = curl_init('http://172.21.4.62:3030/widgets/Skin');
   $curlOptions = array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_FOLLOWLOCATION] => true,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => array("auth_token" => "YOUR_AUTH_TOKEN", "value" => "519"),
    );
   curl_setopt_array($ch, $curlOptions);
   $response = curl_exec($ch);
   curl_close($ch);
Sign up to request clarification or add additional context in comments.

Comments

0

Its easier to use any curl class, f.e. curl.class.php

Usage:

$curl = new Curl();

$data = array("auth_token" => "YOUR_AUTH_TOKEN", "value" => "519");

$page = $curl->post("YOUR_URL_TO_CALL_VIA_CURL", $data);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.