How can I send data to Replit and then get it?

I have this example script in luau:

local HttpService = game:GetService("HttpService")


local scriptUrl = "https://replit.com/@MyUsername/Projectname#index.php"


local requestData = {
	username = "JohnDoe",
	score = 100
}

local requestBody = HttpService:JSONEncode(requestData)

local response = HttpService:PostAsync(scriptUrl, requestBody)

if response then
	local responseData = HttpService:JSONDecode(response)

	local responseValue = responseData["response"]

	print("Answer: " .. responseValue)
else
	print("Error")
end

and on replit I have this in php:

<?php
$requestData = json_decode(file_get_contents('php://input'), true);

$username = $requestData['username'];
$score = $requestData['score'];
echo $score;
echo $username;
$responseData = array(
    'response' => 'Daten erfolgreich empfangen und verarbeitet',
    'username' => $username,
    'score' => $score
);


$responseBody = json_encode($responseData);


header('Content-Type: application/json');

echo $responseBody;
?>
  1. Is this correct like that?
  2. How can I make it better?
    3.Is there a way with GitHub?
    4.I get 403 Forbidden on Roblox.
    Ty for your Help!!!
1 Like

are you authenticating yourself on replit?
is that data publicly avaliable?
does replit block requests from roblox?

  1. No, in the end I want a guilded bot to get the infos, but I have to get the data first.
  2. What data?
  3. I dont know

I really need you knowledge for this. I am stuck here.

why wouldntn u just use js

so much simpler

1 Like

If you get 403 Forbidden that means that https://replit.com/@MyUsername/Projectname#index.php

Tells you that you are forbidden. Probably replit blocks roblox, you put in an incorrect url, or you didnt configure stuff correctly.

Also, Why PHP? That’s ancient, and is prone to bugs, just use NodeJS

replit probably blocks it

cause the thing is, if u did access it anywhere else, you would probably just get a 404

but if you get a 403 even tho ur code isnt sending a 403, it means the webserver gateway interface is blocking your request

Yep.

Either replit blocks roblox, or he has some configurations issues (Maybe replit requires some special headers or url query).