I have cron set up which will run to import the data using the curl. I want to use curl using magento's way
1 Answer
<?php /** * Copyright © All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Vendor\Module\Cron; class GetData { protected $curl; public function __construct( \Magento\Framework\HTTP\Client\Curl $curl ) { $this->curl = $curl; } public funnction execute() { $this->curl->post($url, $params); $result = $this->curl->getBody(); } }