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)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.