1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Windows Http_requests fail after the first three sites

Discussion in 'Legacy GameMaker Community Tech Support' started by nyancats1993, Feb 12, 2019 at 10:44 AM.

  1. nyancats1993

    nyancats1993 Member

    Joined:
    Feb 4, 2019
    Posts:
    9
    So i'm only able to load three sites at a time before all responses fail, even if i re request them, or putting them on a clock incase it was a site prevention from ddos'. but no matter what i try i cant seem to get more then 3 items to load, maybe 4 very rarely if i'm remembering correctly. The fallowing is the Http event and somewhere around line 21 is where i'm getting issues. i was able to prevent crashing but wasn't able to gather more info.

    Code:
    //http_get("https://steambanners.booru.org/index.php?page=post&s=view&id=10623")
    if ds_map_find_value(async_load, "status") >= 0 //if page returns a success
    {
        for (var _i = 0; _i < array_length_2d(getListArray, 0); _i++[SIZE=3];)[/SIZE]   //find the get request in the array
        {
            if (ds_map_find_value(async_load, "id") = getListArray[_i,0])   //match the getID
            {
                var GameID  = getListArray[_i,1]
                var status  = getListArray[_i,2]
                var website = getListArray[_i,3]
                show_debug_message(getListArray[_i,3])
                var siteMap = ds_map_find_value(async_load, "id")
               
                if (string_letters(status) = "steambanners")    //if the iteration is on steambanners website
                {
                   
                    show_debug_message("about to request body")
                    //var body = http_request(steambannersWebsite, "GET", siteMap, "body");   //grab the body of the webpage
                    //show_debug_message("request recieved")
                    //show_debug_message(GameID)
                    bodystring = async_load[? "result"]   ///string thing after testing
                   
                    if (bodystring = undefined)
                    {
                        var get = http_get(website);
                        getListArray[_i,3] = get
                        exit;
                    }
                   
                              ///If this is the first search of the sight
                    if (string_digits(status) = "1")
                    {
                        show_debug_message("status 1 checked")
                        var linkSuffix = string_get(bodystring,"index.php?page=post&amp;s=view&amp;id=",chr(34))     //chr(34) just stands for " search for first
                        linkID = string_digits(linkSuffix)  ///chr(34) is just "    //grab only the digits from this
                        show_debug_message(linkID)
                        clickedLink = steambannersWebsite + "index.php?page=post&amp;s=view&amp&id=" + linkID  // this formats the link
                       
                        //var get = http_get(website + linkSuffix);
                        //getListArray[_i,0] = get;
                        show_debug_message("Linksuffix is being searched for:" + GameID)
                        show_debug_message(clickedLink)
                        getListArray[_i,2] = 2
                        exit;
                    }
                              ///if this is the second or more search of the site
                    if (string_digits(status) = "2")
                    {
                        ///do the second or more search here
                        show_debug_message("SECOND LINK GOT!!!")
                        exit;
                    }
                   
                }
                else
                {break;}   /////////////////////////////REMOVE THIS WHEN ADDING MORE SITES!!!
               
               
            }
        }
    }
    else
    {
    exit;
    }
    
     
    Last edited: Feb 13, 2019 at 12:39 AM
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,547
    First, check async_load[? "status"] == 0 for success, NOT async_load[? "status"] >= 0. A status of 1 means in-progress, and there is no async_load[? "result"] to read yet when that happens.

    Second, follow the posting guidelines and post your code between [code] and [/code] tags. I'm not going to waste my time reading through unindented code that the BBCode parser made a mess on.
     
  3. nyancats1993

    nyancats1993 Member

    Joined:
    Feb 4, 2019
    Posts:
    9
    i'll fix both of those now.

    It turned out to be a premature for loop length. was only looping 4 times.
     
    Last edited: Feb 13, 2019 at 12:56 AM
  4. nyancats1993

    nyancats1993 Member

    Joined:
    Feb 4, 2019
    Posts:
    9
    Well now it's consistently getting the info for 4 sites
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice