# Slim external http calls

**URL:** <https://discourse.slimframework.com/t/slim-external-http-calls/839>\
**Category:** Questions\
**Created:** [October 24, 2016, 1:43pm UTC](https://discourse.slimframework.com/t/slim-external-http-calls/839 "2016-10-24T13:43:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pollux2paris](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pollux2paris](https://discourse.slimframework.com/u/pollux2paris)\
**Post date:** [October 24, 2016, 1:43pm UTC](https://discourse.slimframework.com/t/slim-external-http-calls/839/1 "2016-10-24T13:43:59Z")

</div>

Hi there and first of all thanks for Slim.

Here is my concern.  
I’m implementing a front end using Slim. However my data is served by a back end server providing webservices (soap).  
What I’m trying to do is call this back end then manipulate the data through slim (as Rest apis).

I can’t find a way to do it.  
I’ve tryied imlementing regular php in my controllers but does not work (even no stdClass accessible… then I think there’s no way to instanciate a SoapClient…).

Do you know if there’s a magic package for that or Slim is only designed to work with database through mysqli or eloquent…

---

<div class="post-metadata">

**Author:** ![geggleto](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/geggleto/32/11_2.png) [@geggleto](https://discourse.slimframework.com/u/geggleto)\
**Post date:** [October 24, 2016, 6:41pm UTC](https://discourse.slimframework.com/t/slim-external-http-calls/839/2 "2016-10-24T18:41:28Z")

</div>

This works perfectly fine…

UserService can be a SoapClient or anything else really.

```php

$app->get('/user/{id}', function ($req, $res, $args) {
    $service = $this->get('userService');
    $user = $service->get($args['id']);

    //do things
   return $res->withJson($user);
});

```

---

<div class="post-metadata">

**Author:** ![pollux2paris](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pollux2paris](https://discourse.slimframework.com/u/pollux2paris)\
**Post date:** [October 24, 2016, 10:09pm UTC](https://discourse.slimframework.com/t/slim-external-http-calls/839/3 "2016-10-24T22:09:11Z")

</div>

Thanks guy.  
Having in mind it must work 😉 I just get my issue.

Basic classes from php seems not to be loaded by default and I had to add ‘use’ for them.  
use stdClass;  
use SoapClient;  
…

Then it worked perfectly.

Pollux
