# PHP Client 8.5 Not Response Data

**URL:** <https://discuss.elastic.co/t/php-client-8-5-not-response-data/322670>\
**Category:** Elasticsearch\
**Created:** [January 7, 2023, 7:38pm UTC](https://discuss.elastic.co/t/php-client-8-5-not-response-data/322670 "2023-01-07T19:38:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vcamargo](https://avatars.discourse-cdn.com/v4/letter/v/8baadc/32.png) [@vcamargo](https://discuss.elastic.co/u/vcamargo)\
**Post date:** [January 7, 2023, 7:38pm UTC](https://discuss.elastic.co/t/php-client-8-5-not-response-data/322670/1 "2023-01-07T19:38:44Z")

</div>

When try request do elastic using php client response it's returning always null, I've try using "search", "get" methodos and not working, when a try use postman request it's working, sample code below

Request Status Code: 200  
Body: Null

```auto
$client = ClientBuilder::create()
                ->setBasicAuthentication(
                    config('elasticsearch.user'),
                    config('elasticsearch.password')
                )
                ->setHosts($app['config']->get('elasticsearch.hosts'))
                ->setCABundle(config('elasticsearch.certificate'))
                ->build();

$client->get([
            'index' => 'company',
            'id' => '31244951000130'
        ])->getBody->getContents();

```

---

<div class="post-metadata">

**Author:** ![vcamargo](https://avatars.discourse-cdn.com/v4/letter/v/8baadc/32.png) [@vcamargo](https://discuss.elastic.co/u/vcamargo)\
**Post date:** [January 9, 2023, 12:07am UTC](https://discuss.elastic.co/t/php-client-8-5-not-response-data/322670/2 "2023-01-09T00:07:05Z")

</div>

I found the problem, I missed set the return as "asArray()"

```auto
$response->asArray()

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 6, 2023, 12:07am UTC](https://discuss.elastic.co/t/php-client-8-5-not-response-data/322670/3 "2023-02-06T00:07:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
