0

I'm trying to make a simple API request but I get the 403 code why?

<?php
    $g2aEmail   = 'xxx'; // customer email
    $apiHash    = 'xxx'; // customer API hash
    $apiSecret  = 'xxx'; // customer API secret

    $apiKey     = hash('sha256', $apiHash . $g2aEmail . $apiSecret);


    $getPage = trim(isset($_GET['page'])?$_GET['page']:'1');

if($getPage >=1 && $getPage<=500)
    {
        $getPageCount = $getPage;
    }
    else
    {
        $getPageCount = '1';
    }


$api_endpoint = 'https://products-export-api.g2a.com/v1/products?page=$getPageCount';

$args = array(
    'headers' => array( $apiHash, $apiKey )
); 

$response = wp_remote_get( $api_endpoint, $args );

print $response ['body']; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.