I have created a custom module, and added values directly in my code like hardcode, how to get those values from the admin configuration and passed to my code.
Block:
<?php
namespace Zero\Customerreview\Block;
class Customerreview extends \Magento\Framework\View\Element\Template
{
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
protected function _prepareLayout()
{
parent::_prepareLayout();
}
public function getCustomerReview(){
$authorization = "Authorization: Bearer nhuhtrbhuithtobtougbtgbigbrigboirubgurbgrbgibniutgtbgbuigbuobtrbntrhtrnijhiotgnbgnbhtrhnitgnbgibnrtshgtrnirtn'jhiotrtsnnioonrtrhtitrh";
$url = 'https://mybusiness.googleapis.com/v4/accounts/123456789/locations/987654321/reviews';
$ch = curl_init();
//curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
$allData = json_decode($output, TRUE); // You will get all the data
return $allData;
}
}
I want to get $authorization and account id ( https://mybusiness.googleapis.com/v4/accounts/123456789) details from admin configuration, and also how to pass that account id in URL?