sentanos / roblox-bots

This project is no longer maintained, please consider this instead: https://github.com/sentanos/roblox-js-server
17 stars 28 forks source link

PHP errors #19

Closed LukeTechnoUserOfficial closed 8 years ago

LukeTechnoUserOfficial commented 8 years ago

PHP Build 7.0

[11-May-2016 22:37:55 UTC] PHP Warning: DOMDocument::loadHTMLFile(http://www.roblox.com/Groups/group.aspx?gid=2820985): failed to open stream: Connection timed out in /home/u827506591/public_html/roblox-bots-master/Includes/getRoles.php on line 32 [11-May-2016 22:37:56 UTC] PHP Warning: simplexml_load_file(http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=27453460&groupid=2820985): failed to open stream: Operation now in progress in /home/u827506591/public_html/roblox-bots-master/Includes/misc.php on line 10 [11-May-2016 22:37:56 UTC] PHP Warning: DOMDocument::loadHTMLFile(http://www.roblox.com/Groups/group.aspx?gid=2820985): failed to open stream: Connection timed out in /home/u827506591/public_html/roblox-bots-master/Includes/getRoles.php on line 32 [11-May-2016 22:37:56 UTC] PHP Warning: DOMDocument::loadHTMLFile(http://www.roblox.com/Groups/group.aspx?gid=2820985): failed to open stream: Connection timed out in /home/u827506591/public_html/roblox-bots-master/Includes/getRoles.php on line 32 [11-May-2016 22:38:00 UTC] PHP Warning: simplexml_load_file(http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=27453460&groupid=2820985): failed to open stream: Operation now in progress in /home/u827506591/public_html/roblox-bots-master/Includes/misc.php on line 10 [11-May-2016 22:38:00 UTC] PHP Warning: simplexml_load_file(http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=27453460&groupid=2820985): failed to open stream: Operation now in progress in /home/u827506591/public_html/roblox-bots-master/Includes/misc.php on line 10

LukeTechnoUserOfficial commented 8 years ago

Misc.php:

<?php // These are just a few miscellaneous ROBLOX APIs in php function form that you might want to use. function UsernameFromID($userId) { return json_decode(file_get_contents("http://api.roblox.com/users/$userId"),true)['Username']; } function IDFromUsername($username) { return json_decode(file_get_contents("http://api.roblox.com/users/get-by-username?username=$username"),true)['Id']; } function getRankInGroup($userId,$groupId) { return (int)simplexml_load_file("http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=$userId&groupid=$groupId"); } function fetchShout($cookie,$group) { // Log in for correct permissions $curl = curl_init("http://www.roblox.com/My/Groups.aspx?gid=$group"); curl_setopt_array($curl,array( CURLOPT_RETURNTRANSFER => true, CURLOPT_COOKIEFILE => $cookie, CURLOPT_COOKIEJAR => $cookie )); $response = curl_exec($curl); curl_close($curl); $doc = new DOMDocument(); $doc->loadHTML($response); return $doc->getElementById('ctl00_cphRoblox_GroupStatusPane_StatusTextField')->textContent; } ?>

getRoles.php:

<?php /*

ROBLOX actually has an API for getting group roles including their IDs...
BUT IT'S BROKEN (found out the hard way).
From all the groups I've seen this API will often miss one of the ranks; however, in case
it's ever fixed here's a function that uses it:

function getRoleSets($group) {
    $ranks = array();
    $roles = json_decode(file_get_contents("http://www.roblox.com/api/groups/$group/RoleSets/"),true);
    foreach($roles as $role => $array) {
        $ranks[$array['Rank']] = $array['ID'];
    }
    return $ranks;
}

This is much faster than the following one, if ROBLOX does fix their API you should use it.
It returns both the regular rank array and another array that has the rank matched with its role.
To get this do:
list($ranks,$roles) = getRoleSets($group);

If you want the best performance put in the ranks manually.

*/
function getRoleSets($group) {
    $roles = json_decode(file_get_contents("http://api.roblox.com/groups/$group"),true)['Roles'];
    $ids = array();
    $ranks = array();
    $url = "http://www.roblox.com/Groups/group.aspx?gid=$group";
    $doc = new DOMDocument();
    $doc->loadHTMLFile($url);
    $find = new DomXPath($doc);
    $nodes = $find->query('//select[contains(@id,\'ctl00_cphRoblox_rbxGroupRoleSetMembersPane_dlRolesetList\')]//option[@value]');
    foreach ($nodes as $node) {
        $ids[$node->textContent] = $node->getAttribute('value');
    }
    foreach ($ids as $name => $id) {
        foreach ($roles as $array) {
            if ($name == $array['Name']) {
                $ranks[$array['Rank']] = $id;
            }
        }
    }
    return array($ranks,array_flip($ids));
}
function getRoleSet($ranks,$rank) {
    foreach($ranks as $num => $roleset) {
        if ($rank == $num) {
            return $roleset;
        }
    }
}

?>

suufi commented 8 years ago

Is your receiver.php file outside the roblox-bots-master folder?

AdamsBlack commented 8 years ago

This isn't an issue with the code, the issue lies within your setup.

LukeTechnoUserOfficial commented 8 years ago

Okay I'll try looking again at my setup

LukeTechnoUserOfficial commented 8 years ago

My file setup seems to be correct. I don't feel I have missed anything. And yeah the receiver is outside the whole folder with the roblox-bots-master. The promotion bot only works once a day for some reason because only one person gets promoted e.e

sentanos commented 8 years ago

The problem seems to be with your host (a part of your setup).

LukeTechnoUserOfficial commented 8 years ago

What does this mean?

[12-May-2016 08:48:12 UTC] PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 [12-May-2016 08:48:13 UTC] PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 [12-May-2016 08:48:13 UTC] PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

sentanos commented 8 years ago

That is a deprecation warning, it is not serious and does not affect script functionality whatsoever.

LukeTechnoUserOfficial commented 8 years ago

Well everything I try doesn't work

LukeTechnoUserOfficial commented 8 years ago

Can you just add me on Skype and help me 1-to-1 and solve my problem? Skype - luketechnocorps

ghost commented 8 years ago

Is your host Hostinger?

LukeTechnoUserOfficial commented 8 years ago

Yeah, it doesn't seem to work

ghost commented 8 years ago

From my experience, I can say that Hostinger is really bad and I also had the same problem with Hostinger. Try something else.

LukeTechnoUserOfficial commented 8 years ago

Do you have any suggestions? like what do you normally use?

AdamsBlack commented 8 years ago

Totally off topic, but if you host with any of those companies you're a fool.

LukeTechnoUserOfficial commented 8 years ago

Please give me a good one please

sentanos commented 8 years ago

This issue has become unrelated to the scripts themselves. Close #19, do not make another issue related to your own setup only.