Welcome Guest, Not a member yet? Register   Sign In
POSTing to CodeIgniter API
#1

Hey Guys,

I'm working with a codeigniter website with API and for some reason I am unable to get server-side content from POST requests. 

Here is some code samples of the API. Everything works fine when POSTing from the website to the server, but via a service like POSTman I cannot seem to view data as I normally would aka $this->input->post('my_field') 

https://gist.github.com/simistern/6af216...81dd050745
https://gist.github.com/simistern/063d3e...101ee33781



Any help would be greatly appreciated!
Reply
#2

(This post was last modified: 08-15-2017, 06:54 PM by jarmen_kell.)

judging from the way you code your PHP script,
you're doing it wrong.

you couldn't just catch a value from a function that doesn't have any 'return' words.
and the way you put your 'return' r-word from the index clearly indicates that you
needs to understand the way how a simple 'functional' (or a little OOP) works.

here's a resource that might help on understanding how function works.
https://www.kidscodecs.com/programming-functions/

and here's also a little insight about how OOP works in PHP.
probably not the best tutorial, but it should do:
https://www.tutorialspoint.com/php/php_o...iented.htm
Reply




Theme © iAndrew 2016 - Forum software by © MyBB