http.Fetch problem


I have an auto donation script that uses a http.Fetch function to check my website for a user’s donation status (either a ‘1’ or nothing).
Unfortunately the code fails to see the ‘1’ that is present when I (my donation status is ‘1’ for testing) joins, and defaults to the ‘else’ code.

function PlayerConnect( ply )    http.Fetch("" .. ply:SteamID(),
        function( HTML )
            if HTML == "1" then
                game.ConsoleCommand("ulx asay Donation system success!")
                game.ConsoleCommand("ulx adduser " .. ply:SteamID() .. " donator")
                Msg("This user /is/ a donator..")
                Msg("User is /not/ a donator.")
hook.Add( "PlayerInitialSpawn", "AutoDonate", PlayerConnect )

For example, my steam ID is STEAM_0:1:41910048. When I join, the ID is parsed with the link in order to check the donation status of the user.

Can anyone provide any insight on this issue? I can provide extra details if necessary.
Thanks in advance.

There is whitespace in front of your “1” in the HTML code. Should be pretty freaking obvious what you need to do.

I would try Parsing the page rather than just checking if a string matches.

Did you ever try, you know, printing the output of HTML?

Keep in mind, not everyone is wonderfully gifted at programming, and some of us are here to learn :downs:

How would I go about printing it plain text? Here’s the PHP:

while($row = mysqli_fetch_array($result))
    echo $row['rank'];

I’m not actually seeing any whitespace?

Print the HTML in lua and see what it’s coming out as.

I added a space before the ‘1’ in the code off a whim and it actually worked.
Thank you for your help everyone.