PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, May 19, 2022

[FIXED] How can I separate the output of the web service?

 May 19, 2022     php, pointers, web-services     No comments   

Issue

I get this result from web service in php code:

> stdClass Object (
>     [Post_Added_Record_ByMenuIDResult] => stdClass Object
>         (
>             [HTMLStructure] => ثبت انجام شد
>             [IsAuthenticated] => 1
>             [MenuID] => 1191
>             [Password] => 
>             [PersonID] => 27598
>             [PersonalityID] => 31413
>             [RecordValues] => 
>             [RoleID] => 5
>             [Sexuality_Title] => m
>             [UserName] => mr.piri
>         ) )

I want to get the opposite phrase in [HTMLStructure]. in this example : ثبت انجام شد

if (strstr( $result, 'HTMLStructure' ) ) {
       $HTMLStructurePos=strpos( $result, '[HTMLStructure] =>' );
       echo $HTMLStructurePos;
       $IsAuthenticatedPos=strpos( $result, '            [IsAuthenticated]' );
       echo $IsAuthenticatedPos;
       $result2 = substr($result, $HTMLStructurePos, $IsAuthenticatedPos);
  echo "<pre>";
   print_r($result2);
   echo "</pre>";
} else {
  echo "Not found";
}

but i get

Not found

in the out put.

I think this is a structure and I have to get the value with the pointer.But does anyone know how?


Solution

i solved this problem by this code:

foreach ($result as $obj)
{
    // Here you can access to every object value in the way that you want
    $result2 = $obj->HTMLStructure;
}


Answered By - Mohadeseh
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing