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

GM:S 1.4 http_post_string to php help

Discussion in 'Programming' started by Dengar, Jun 26, 2016.

Tags:
  1. Dengar

    Dengar Member

    Joined:
    Jun 21, 2016
    Posts:
    285
    Code:
    //snippet of code
    var sending = keyboard_string;
    post = http_post_string("http://www.dengar.byethost10.com/newchar.php", sending);
    my code works on a localhost but I created a domain with byet.host and uploaded my php files to the htdocs folder but I cant get it to work and I don't kno how to debug it.

    did I write the address correctly?
    am I missing something like a password?
     
  2. NoobsWeStand

    NoobsWeStand Member

    Joined:
    Jun 20, 2016
    Posts:
    143
    try putting this at the beginning of your PHP file
    PHP:
    header('Access-Control-Allow-Origin: *');
     
  3. Dengar

    Dengar Member

    Joined:
    Jun 21, 2016
    Posts:
    285
    tried it but nothing changed.

    could it be because im using a sub-domain?
     
    Last edited: Jun 26, 2016
  4. NoobsWeStand

    NoobsWeStand Member

    Joined:
    Jun 20, 2016
    Posts:
    143
    I don't think so. That shouldn't matter.
    The GML code looks fine, and testing with fiddler did not give me an "access denied" or anything like that

    It must be something with your php
    Try putting these in your PHP code and see if it throws you an error
    PHP:
    ini_set('display_startup_errors',1);
    ini_set('display_errors',1);
     
  5. Dengar

    Dengar Member

    Joined:
    Jun 21, 2016
    Posts:
    285
    nothing changed. where would these error messages appear?
     
  6. Dengar

    Dengar Member

    Joined:
    Jun 21, 2016
    Posts:
    285
    alright, with abit of fiddling I setup a simple test php file. I use http_post_string and all the php file does is echoes a simple string "this test works" but instead I got this.
    Code:
    html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("5725b73ad3d801a61abc7d54500bc31d");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; document.cookie="referrer="+escape(document.referrer); location.href="http://dengar.byethost10.com/tester.php?ckattempt=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html
    what does that mean? it doesn't look like any php error messages ive seen before
     
  7. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,327
    Get a different host or pay up, this is the work of a server-side mod at ByetHost for unpaid users.
     
  8. icuurd12b42

    icuurd12b42 TMC Founder GMC Elder

    Joined:
    Apr 22, 2016
    Posts:
    1,837
    Looks like your host is not providing a direct link to your site and telling the browser to redirect via javascript commands
     

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