adicionou 68 caracteres ao conteúdo
Fonte Link
novic
  • 36,5mil
  • 4
  • 30
  • 66

Configure o USERAGENT com o paramentro Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0), tanto com file_get_contents ou curl:

Com file_get_contents:

<?php

    $url = "https://api.cartolafc.globo.com/mercado/destaques";

    $options = array(
        'http' => 
          array(
            'method' => 'GET', 
            'user_agent' => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 
            'timeout' => 1
            )
    );

    $context = stream_context_create($options);
    $file = file_get_contents($url, false, $context);
    $sol = json_decode($file, true);    
    var_dump($sol);

Com curlcurl:

<?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_URL => 'https://api.cartolafc.globo.com/mercado/destaques',
        CURLOPT_SSL_VERIFYPEER => FALSE,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'
    ));
    
    $result = curl_exec($curl); 
    $sol = json_decode($result, true);  
    var_dump($sol);

Referencias:

Configure o USERAGENT com o paramentro Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0), tanto com file_get_contents ou curl:

Com file_get_contents:

<?php

    $url = "https://api.cartolafc.globo.com/mercado/destaques";

    $options = array(
        'http' => 
          array(
            'method' => 'GET', 
            'user_agent' => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 
            'timeout' => 1
            )
    );

    $context = stream_context_create($options);
    $file = file_get_contents($url, false, $context);
    $sol = json_decode($file, true);    
    var_dump($sol);

Com curl:

<?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_URL => 'https://api.cartolafc.globo.com/mercado/destaques',
        CURLOPT_SSL_VERIFYPEER => FALSE,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'
    ));
    
    $result = curl_exec($curl); 
    $sol = json_decode($result, true);  
    var_dump($sol);

Referencias:

Configure o USERAGENT com o paramentro Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0), tanto com file_get_contents ou curl:

Com file_get_contents:

<?php

    $url = "https://api.cartolafc.globo.com/mercado/destaques";

    $options = array(
        'http' => 
          array(
            'method' => 'GET', 
            'user_agent' => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 
            'timeout' => 1
            )
    );

    $context = stream_context_create($options);
    $file = file_get_contents($url, false, $context);
    $sol = json_decode($file, true);    
    var_dump($sol);

Com curl:

<?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_URL => 'https://api.cartolafc.globo.com/mercado/destaques',
        CURLOPT_SSL_VERIFYPEER => FALSE,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'
    ));
    
    $result = curl_exec($curl); 
    $sol = json_decode($result, true);  
    var_dump($sol);

Referencias:

Fonte Link
novic
  • 36,5mil
  • 4
  • 30
  • 66

Configure o USERAGENT com o paramentro Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0), tanto com file_get_contents ou curl:

Com file_get_contents:

<?php

    $url = "https://api.cartolafc.globo.com/mercado/destaques";

    $options = array(
        'http' => 
          array(
            'method' => 'GET', 
            'user_agent' => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 
            'timeout' => 1
            )
    );

    $context = stream_context_create($options);
    $file = file_get_contents($url, false, $context);
    $sol = json_decode($file, true);    
    var_dump($sol);

Com curl:

<?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_URL => 'https://api.cartolafc.globo.com/mercado/destaques',
        CURLOPT_SSL_VERIFYPEER => FALSE,
        CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'
    ));
    
    $result = curl_exec($curl); 
    $sol = json_decode($result, true);  
    var_dump($sol);

Referencias: