Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

391
Visualizações
converting a $_GET cURL request to Laravel 8.x http request not working as expected (returns 403 error)

I have the following cURL request in Postman which works perfectly fine, however I am having issues getting the same response data once I have converted this cURL request into a Laravel 8.x format using the HTTP facade.

curl request

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://proclubs.ea.com/api/fifa/clubs/info?platform=ps4&clubIds=1741008');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Referer' => 'https://www.ea.com/'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

Laravel HTTP request

// have added use Illuminate\Support\Facades\Http; at the top of class

    $url = 'https://proclubs.ea.com/api/fifa/clubs/info';
    $params = [
        'platform' => 'ps4',
        'clubIds' => 1741008
    ];

    $response = Http::withHeaders([
        'Referrer' => 'https://www.ea.com/',
    ])->get($url, $params)->json();   
    dd($response);

expected output

{
    "1741008": {
        "name": "BanterburyFC",
        "clubId": 1741008,
        "regionId": 4344147,
        "teamId": 112092,
        "customKit": {
            "stadName": "Wanda Metropolitano",
            "kitId": "1836515329",
            "isCustomTeam": "0",
            "customKitId": "7623",
            "customAwayKitId": "7623",
            "customKeeperKitId": "5012",
            "kitColor1": "1987272",
            "kitColor2": "0",
            "kitColor3": "16777215",
            "kitAColor1": "16734520",
            "kitAColor2": "0",
            "kitAColor3": "16777215",
            "dCustomKit": "0",
            "crestColor": "1987272",
            "crestAssetId": "99040402"
        }
    }
}

actual output

null // getting a 403 error response

When running the debug() command in Laravel I can see the following error

old SSL session ID is stale, removing * Mark bundle as not supporting multiuse < HTTP/1.1 403 Forbidden - how do I fix this?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have misspelled the header name. It is Referer with one r not two. Change your code to this and it should work:

$response = Http::withHeaders([
    'Referer' => 'https://www.ea.com/',
])->get($url, $params)->json();
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda