fabio.versolatto Posted October 13, 2021 Share Posted October 13, 2021 Hi all !!! I'm trying to send a simple POST from an admin module I'm developing using curl and the result is always 308. The same POST using postman, for example, same URL, same Header returns 200. PS: Calling GET methods, everything works fine! I've tried everything but I don't know how to proceed anymore. My PS version is 1.7.7.8 and follow my code PS: I've developed a class (attached) to encapsulate curl methods (not a single comma outside the documentation) follow my methods.. //CONTROLLER METHOD public function saveKeyAction(Request $request){ $apiKey = $request->request->get('txtApiKey'); $this->saveApiKey($apiKey); return $this->load($request); } //PRIVATE METHOD private function saveApiKey($apiKey){ $store_name_req = $this->getStoreName(); $moove_saveAPIKeyEndpoint = self::API_MOOVE_WEBSTORE . "/" . $store_name_req . "/" . $apiKey; $httpObject = new HttpHelper(); $httpObject->setHeader("Authorization", 'Bearer ' . self::API_MOOVE_WEBSTORE_TOKEN); $httpObject->setHeader("Content-Type", 'application/json'); $ret = $httpObject->post($moove_saveAPIKeyEndpoint, array()); print_r($ret->getInfo()); } if you guys have any idea, please send me best regards ! HttpHelper.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now