Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6850191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:05:37+00:00 2026-05-27T01:05:37+00:00

I’m probably missing something quite basic, but I’m getting very confused (and frustrated) with

  • 0

I’m probably missing something quite basic, but I’m getting very confused (and frustrated) with the results I get from my SOQL queries to the Salesforce API.

My query:

Select Id, FirstName, LastName FROM contact

The resulting object (as rendered by print_r):

stdClass Object
(
    [done] => 1
    [queryLocator] => 
    [records] => Array
        (
            [0] => stdClass Object
                (
                    [type] => Contact
                    [Id] => Array
                        (
                            [0] => 0032000000cPd7uAAC
                            [1] => 0032000000cPd7uAAC
                        )
                    [any] => BuzzAldrin
                )
            [1] => stdClass Object
                (
                    [type] => Contact
                    [Id] => Array
                        (
                            [0] => 0032000000cPt1zABC
                            [1] => 0032000000cPt1zABC
                        )
                    [any] => RonnieVanZant
                )
            [2] => stdClass Object
                (
                    [type] => Contact
                    [Id] => Array
                        (
                            [0] => 0032000000cPb60AA
                            [1] => 0032000000cPb60AA
                        )

                    [any] => PollyJeanHarvey
                )
        )
    [size] => 3
)

The first thing I don’t get is why “Id” is an array. A strange quirk, but a workaround is not too hard.

The second thing bothers me endlessly more, though: I select for FirstName and LastName and what happens is they get concatenated and returned as a single string value for a field called “any”. To avoid the “split it on uppercase letters” advice I already got from my colleagues, I provided an example with both a two-capital first name and a two-capital last name, and anyhow, in reality I need many more (and more formally unpredictable) fields, and they all get added to this “any” property.

Does anyone see what I’m doing wrong? Assuming it’s not such a badly written API, that is?

Edit:

Said developer will now go sit in a corner for a few hours, repenting for not having checked for more recent versions of PHP Toolkit. Seems I was using 11.0, whereas there’s already a version 20.0. Shame on me, shame on me indeed. Sorry for wasting your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:05:38+00:00Added an answer on May 27, 2026 at 1:05 am

    The behavior you are seeing is mostly because of how PHP’s SoapClient interprets the results from the API. If you call getLastResponse() on your API connection after you make the query() calls above, you’ll see what the actual SOAP messages look like coming back from Salesforce.

    As far as the Id array — its not really an array, but it is listed twice per record (once for the record itself and once as a field), but PHP turns it into an array because it sees it twice. As far as the any, that’s happening because PHP is not understanding the namespaced field tags correctly.

    As it looks like you found, using the PHP Toolkit can help with these oddities and return sensible objects for you to work with. You might also want to consider looking at Salesforce’s REST API, whose results can be directly consumed by json_decode(). For making the HTTP calls to Salesfore, you might be interested in this simple (almost standalone) REST client in a project of mine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.