PHP code example of mikemiles86 / bazaarvoice-request

1. Go to this page and download the library: Download mikemiles86/bazaarvoice-request library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mikemiles86 / bazaarvoice-request example snippets

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

 php

$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$reviews = $bazaarvoice_request->apiRequest('data/reviews');
 php

$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$reviews = $bazaarvoice_request->useStage()->apiRequest('data/reviews');
 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$configuration = [
  'method' => 'POST',
  'options' => [
    'headers' => [
      'X-Forwarded-For' => '127.0.0.1',
    ],
  ],
];

$reviews = $bazaarvoice_request->apiRequest('data/reviews', $configuration);
 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$configuration = [
  'arguments' => [
    'ProductId' => 'my_product_123',
   ],
];

$product_reviews = $bazaarvoice_request->->apiRequest('data/reviews', $configuration);
 php

$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$response = $bazaarvoice_request->useStage()->apiRequest('data/reviews');

$reviews = $response->getResponse('Results');

 php

$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$response = $bazaarvoice_request->useStage()->apiRequest('data/reviews');

if ($response->getStatusCode() != '200' || $response->hasErrors()) {
  $errors = $response->getErrors();
}