How can I make Requests library work identical to file_get_contents?

45 Views Asked by At

I am using https://requests.ryanmccue.info/ for my PHP requests and it is not working for one specific request to a Roblox API.

My Requests code (not working):

<?php
require_once "src/Autoload.php";
WpOrg\Requests\Autoload::register();
$request = WpOrg\Requests\Requests::get("https://games.roblox.com/v1/games/list?sortToken=T638231628258597209_Curated,R,H_a79d");
echo $request->body;
?>

My file_get_contents code (working):

<?php
$body = file_get_contents("https://games.roblox.com/v1/games/list?sortToken=T638231628258597209_Curated,R,H_a79d");
echo $body;
?>

How can I revise the Requests code to work identical to the file_get_contents code which is currently working for me?

0

There are 0 best solutions below