HEX
Server: Apache
System: Linux vpshost11508.publiccloud.com.br 5.15.179-grsec-vpshost-10.lc.el8.x86_64 #1 SMP Mon Apr 7 12:04:45 -03 2025 x86_64
User: wicomm2 (10002)
PHP: 8.3.0
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: /home/storage/5/78/dd/wicomm2/public_html_backup/clientes/oferenda/getProduct/index.php
<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS');
header('Access-Control-Allow-Headers: access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,content-type');
header('Content-Type: application/json');
header("Access-Control-Allow-Credentials: true");
ini_set('display_errors', 1);
set_time_limit(0);//evitar Fatal error: Maximum execution time of 30 seconds exceeded



function GET($url){

    /**
     * headers do curl
     */
    $headers = array(
        "accept: application/json",
        "content-type: application/json",
        "rest-range: resources=0-900", 
        "Authorization: Basic aofer-f1e68f9f-73b7-4625-b702-d7b0682b2cad"
    );
  
    /**
     * iniciando a sessao
     */
    $cSession = curl_init();
  
    /**
     * aplicando as variaveis
     */
    curl_setopt($cSession, CURLOPT_URL, $url);
    curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($cSession, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
  
    /**
     * executando curl
     */
    $result = curl_exec($cSession);
    $result = json_decode($result, true);
  
    /**
     * fechando a  conexao curl
     */
    curl_close($cSession);

    

  
    /** 
     * retorno da funcao com var_dump
     */
    return $result;

}


function getProduct(){

    $productId = $_GET['productId'];
    
    $url = "https://api.fbits.net/produtos/".$productId."?tipoIdentificador=ProdutoVarianteId";

    $result = GET($url);

    echo json_encode($result);

}

getProduct();

?>