May I Use Http::post In Place_Order Function?

I have a function in my addon in func.php called fn_myaddon_place_order. In this function I am getting amount of product in DB and send product amount info to an another web site to decrease stock amount remotely.



Although the code is ok, Http::post function doesn’t work. I use the code below on everywhere I want. But it doesn’t work in place_order function.


<br />
Registry::set('log_cut_data', array('soap'));<br />
	 $response = Http::post("https://api.n11.com/ws/ProductService.wsdl", $post_data, array( 'headers' => array('Content-type: text/xml')));<br />

```<br />
<br />
When I place an order to test it, browser stops while placing order. Is there a problem, a difference usage about using  Http::post in place order function?

[quote name='ooaykac' timestamp='1425295050' post='206762']

I have a function in my addon in func.php called fn_myaddon_place_order. In this function I am getting amount of product in DB and send product amount info to an another web site to decrease stock amount remotely.



Although the code is ok, Http::post function doesn't work. I use the code below on everywhere I want. But it doesn't work in place_order function.



Registry::set('log_cut_data', array('soap'));
$response = Http::post("https://api.n11.com/ws/ProductService.wsdl", $post_data, array( 'headers' => array('Content-type: text/xml')));




When I place an order to test it, browser stops while placing order. Is there a problem, a difference usage about using Http::post in place order function?

[/quote]



Hello,



It is necessary to add the 'init.php' file near the 'func.php' file with the following content:


```php


fn_register_hooks('place_order'); ```

Sincerely yours,
CS-Market.

Thanks CS-Market. But I know, the function is already registered in init.php. place_order function works well, but Http::post request doesn’t work in place_order function.

I use Http::post request almost in every function I need and works good. But only in this function it doesn’t work. :(

deleted

Sorry. I found the problem. I forgot to add use Tygh\Http; in func.php. :grin: I have added. Now it works.