0

So my server is no longer accepting formData however if I call with a string with all the parameters concatenated it works. So this WAS working before and now its not. So I set up my formData object and pass it in to a function that generates an $http.post() object:

function HTTPClient($http, $rootScope, arguments){
    return $http.post($rootScope.URL, arguments,{
        headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    });
}

But when I call

var_dump($_POST);

I get

array(0)

Why isn't this working anymore? I suspect its a change in our backend (I'm not the main server person) can someone help, our website is suddenly nonfunctional.

user3194367
  • 2,987
  • 3
  • 13
  • 10

2 Answers2

1

POST and GET are not the same thing :)

function HTTPClient($http, $rootScope, arguments){
return $http.post($rootScope.URL, arguments,{
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
}

this should do the job :) more about those two http requests:

http://www.w3schools.com/tags/ref_httpmethods.asp

messerbill
  • 5,499
  • 1
  • 27
  • 38
  • That method call isn't there, I miseditted the post. – user3194367 Jun 24 '15 at 15:21
  • you dont need that "method: POST" becuase, $http.post() does exactly this :) – messerbill Jun 24 '15 at 15:24
  • The method call isn't there, I've fixed up the post to the actual code (I had been doing a bunch of fiddling around just before I posted this) – user3194367 Jun 24 '15 at 15:26
  • because your var_dump($_POST) equals "array(0)" it shows, that your formular data is empty. I think its not read correctly by the client, but i dont know until you post more of your code. plz edit your question to do so. maybe this could help you as well: http://stackoverflow.com/questions/409351/post-vs-serverrequest-method-post – messerbill Jun 24 '15 at 21:40
1

Alright, so after completely botching my post here most people reasonably (accurately?) assumed I was an idiot and answered as such. I was able to find the issue however, our server was upgraded to HTTPS without my knowledge, and our server administrator didn't feel inclined to mention that when I asked "did you make any changes to the server?".

So if your client is HTTP and your server is HTTPS it'll reject form data!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user3194367
  • 2,987
  • 3
  • 13
  • 10