0

From my SOAP services, how do i change the data i got from this soap service :

Array
(
    [NE] => 42616324457
    [EMAIL] => [email protected]
    [TIPE] => POSTPAID
    [NAMA] => ALBERTHO
    [TELP] => 0812345678
    [DN] => 127272748174
    [STATUS_LOGIN] => 1
    [DESC_LOGIN] => Valid
)

Being a form like this :

Array
(
     [0] => stdClass Object
         (
            [id] => 1
            [NE] => 42616324457
            [EMAIL] => [email protected]
            [TIPE] => POSTPAID
            [NAMA] => ALBERTHO
            [TELP] => 0812345678
            [DN] => 127272748174
            [STATUS_LOGIN] => 1
            [DESC_LOGIN] => Valid
            [PASSWORD] => malaquena
         )

  )

My SOAP services code :

<?php
require_once('lib/nusoap.php');

$Email     = $_GET['email'];
$Password   = $_GET['pass'];

 $client = new nusoap_client('http://vcare.telkomvision.net.id/services/VcareServices.php');
$BacaSOAP = $client->call('validateLogin', array('EMAIL' => $Email, 'PASSWORD' => md5($Password)));
?>

Please help me change the format of the array on the

2

2 Answers 2

1

Just cast to object:

$array = array('A' => 0, 'B' => 1);
$array = array((object)$array);
print_r($array);

Result:

Array (
    [0] => stdClass Object (
         [A] => 0
         [B] => 1
     )
)
Sign up to request clarification or add additional context in comments.

Comments

0

create a stdClass

$data = array(
    'ne' => 1231232,
    'email' => 'asdasdsda'
);

$object = new stdClass();
foreach($data as $key => $value) {
    $object->$key = $value;
}
print_r($object);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.