Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

384
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!