cannot use http_post_string to localhost

Discussion in 'Programming' started by AliBahrami, Jun 4, 2017.

  1. AliBahrami

    AliBahrami Guest

    I have a domain name and the code works perfectly on it. When I try to use localhost instead of the url, I cannot.
    So the problem must lie in the wamp, which I use, and the comminucation and ports.
    code in game maker studio :

    input_team = get_string("Enter your team name", "")
    input_pass = get_string("Enter your pass", "")
    send = "name=" + string(input_team) + "pass=" + string(input_pass)
    post = http_post_string("", send)

    code in php:
    $obj->tacticT = 3;
    $obj->bodyT = 4;
    $obj->goalT = 1;
    $j = json_encode($obj);
    echo $j;
    return $j;

    when I remove the url and add localhost, even I copy and paste it in browser and it works, game maker cannot do the right thing.
    Thanks for any help
  2. jmack20093

    jmack20093 Member

    Feb 23, 2018
    i know this is old, but for future people who find this just add "http://" in front of localhost. It seems like game maker requires it.
  3. PNelly

    PNelly Member

    Jun 20, 2016
    This is also often necessary in the "real world", if you're trying to hit a particular IP without it's domain name.
  4. Guest User

    Guest User Guest

    So is any other software. You need a virtual host for this operation to work i.e a domain, I am not sure if this is going to work for GameMaker but it worked for me when I was using PayPal APIs to send to Localhost, as a matter of fact, you don't really need a domain, or at least you don't need to buy a domain.

    To get this to work you need to build a server in your computer. How you may ask?
    Download and install Xampp and get the server running.
    You need to list your domain name in the hosts file in your windows folder, follow this path and you will find it
    add your domain name at the very bottom of the hosts
    Then from Xampp control panel edit the Apache httpd.conf files and configure a virtual host for your domain.

    This is just a brief idea, with simple Google search you can find many articles that show you how to achieve this. Here is an article I've just found

    Tell if it works for you :)

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