GET API,返回结果,如何发布它们

I have been issued to call this API from a Car company and post it to WordPress posts with custom fields. I can successfully call the API in postman, below is the code I have generated from Postman. My next stage is to connect to WordPress and send this data so that each post will have one full set of information about said car. My PHP knowledge is rather basic, I believe I will be using the wp_remote_get and wp_remote_post, utilizing the REST API in order to get started what would you suggest I start with. Do I create a plugin which then runs in the background, or do I create a theme with Functions.php I am unsure at current what would be the best working practice. I understand this is probably vague but after researching and watching videos, all are using API feeds which don't require authentication. So I am a bit stuck, any advice would be fully appreciated.

        <?php

        $client = new http\Client;
        $request = new http\Client\Request;

        $request->setRequestUrl('https://api.****.net/APIv2/Vehicles/StockList');
        $request->setRequestMethod('GET');
        $request->setQuery(new http\QueryString(array(
        'stockListOptionModel.includeusedvehicles.includeImageDetails.includeVideoDetails' => 'true'
        )));

        $request->setHeaders(array(
        'cache-control' => 'no-cache',
        'Connection' => 'keep-alive',
        'Host' => 'api.***.net',
        'Postman-Token' => '79e50f16-0d32-402e-9586-34d7bc8fc590,0741d89a-02d8-4b50-8633-0f3c2eba8c1c',
        'Cache-Control' => 'no-cache',
        'User-Agent' => 'PostmanRuntime/7.15.2',
        'Content-Type' => 'application/x-www-form-urlencoded',
        'Accept-Encoding' => 'gzip, deflate',
        'OrganisationalUnit_UID' => 'a3db2a66-***-4ac2-a78a-0f042aab50af',
        'Password' => '***',
        'UserName' => 'api@*****.co.uk',
        'Accept' => 'application/json'
        ));

        $client->enqueue($request)->send();
        $response = $client->getResponse();

        echo $response->getBody();
dsk95913
dsk95913 感谢您的建设性反馈。我会继续这样做..
大约一年之前 回复
dop20345
dop20345 请阅读如何询问。这是一个过于宽泛的问题。WP附带了插入新帖子对象的方法-进行一些研究,尝试一些事情,在遇到实际问题时报告回来。
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问