External api call using wordpress

Your curl request should work from the command line. Put you will want to use make it in a PHP file:

    $ch = curl_init();

    $url = "https://api.com/";

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);

    http_build_query(array('postvar1' => 'value1')));

    // Receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $api_output = curl_exec($ch);


Which php file you put the curl in is going to be dependent on what you are trying to accomplish. For instance, you might setup a cron job to query the api once and hour, updating your content as necessary. Knowing what you are doing would allow me to provide more guidance.