Jump to content

Help Trying to Access Field in StdObject


nz_mitch

Recommended Posts

Hi there

 

I've been nutting away at this all day and haven't had any luck. Had a quick search around here and on Google but haven't been able to find a solution I can understand... it's all a bit beyond me. Any help would be much appreciated!

 

I'm trying to get the email addresses out of the following object which I'm pulling down through the Wufoo Query API. I've got it outputting successfully like this when I do a print_r()

 

stdClass Object
(
    [FormId] => 33
    [Name] => Register Buyers App
    [Description] => 
    [RedirectMessage] => Success! Thanks for filling out my form!
    [Redirect] => 
    [url] => register-buyers-app
    [Email] => 
    [styleId] => 10
    [isPublic] => 1
    [uniqueIP] => 0
    [OffsetHeight] => 758
    [ReplyTo] => 0
    [ConfirmationFromAddress] => 
    [ConfirmationSubject] => 
    [ReceiptReplyTo] => 
    [FromAddress] => 
    [ReceiptMessage] => 
    [ReceiptCopy] => 
    [Language] => english
    [EmailNewEntries] => 0
    [EmailNewComments] => 0
    [PhoneNewEntries] => 0
    [PhoneNewComments] => 0
    [Mobile] => 
    [Carrier] => 
    [MerchantEnabled] => 
    [LabelAlign] => topLabel
    [startDate] => 2000-01-01 12:00:00
    [EndDate] => 2030-01-01 12:00:00
    [EntryLimit] => 0
    [PlainText] => 0
    [useCaptcha] => 1
    [DateCreated] => 2010-02-21 22:44:39
    [DateUpdated] => 2010-02-23 15:10:34
    [breadCrumbType] => 1
    [showPageTitle] => 1
    [showPageFooter] => 1
    [PaymentPageTitle] => 0
    [RulesEnabled] => 1
    [NonCriticalIntegrations] => 
    [EntryCount] => 2
    [CurrentPage] => 1
    [PageCount] => 1
    [PageBreaks] => Array
        (
        )

    [Fields] => Array
        (
            [0] => stdClass Object
                (
                    [FieldId] => 1004
                    [Title] => Buyer Name
                    [instructions] => 
                    [Typeof] => text
                    [size] => medium
                    [isRequired] => 1
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 0
                    [Pos] => 0
                    [ColumnId] => 1
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => leftHalf
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [1] => stdClass Object
                (
                    [FieldId] => 1010
                    [Title] => Introduced On
                    [instructions] => 
                    [Typeof] => eurodate
                    [size] => medium
                    [isRequired] => 1
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 
                    [Pos] => 1
                    [ColumnId] => 8
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => rightHalf
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 0
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [2] => stdClass Object
                (
                    [FieldId] => 1005
                    [Title] => Buyer Feedback
                    [instructions] => 
                    [Typeof] => textarea
                    [size] => medium
                    [isRequired] => 0
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 0
                    [Pos] => 2
                    [ColumnId] => 5
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => 
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [3] => stdClass Object
                (
                    [FieldId] => 1006
                    [Title] => Agent
                    [instructions] => 
                    [Typeof] => text
                    [size] => medium
                    [isRequired] => 0
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 0
                    [Pos] => 3
                    [ColumnId] => 2
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => hide
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [4] => stdClass Object
                (
                    [FieldId] => 1007
                    [Title] => Property
                    [instructions] => 
                    [Typeof] => text
                    [size] => medium
                    [isRequired] => 0
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 0
                    [Pos] => 4
                    [ColumnId] => 3
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => hide
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [5] => stdClass Object
                (
                    [FieldId] => 1008
                    [Title] => Registering Agent Email
                    [instructions] => 
                    [Typeof] => email
                    [size] => medium
                    [isRequired] => 0
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 
                    [Pos] => 5
                    [ColumnId] => 13
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => 
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 0
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [6] => stdClass Object
                (
                    [FieldId] => 1009
                    [Title] => Receiving Agent Email
                    [instructions] => 
                    [Typeof] => email
                    [size] => medium
                    [isRequired] => 0
                    [isUnique] => 0
                    [isPrivate] => 0
                    [Validation] => 0
                    [Pos] => 6
                    [ColumnId] => 12
                    [FormId] => 33
                    [Price] => 0
                    [ClassNames] => hide
                    [isEncrypted] => 0
                    [RangeType] => character
                    [RangeMin] => 0
                    [RangeMax] => 
                    [DefaultVal] => 
                    [ChoicesText] => 0
                    [settings] => Array
                        (
                            [0] => 
                        )

                    [Page] => 1
                    [MerchantEnabled] => 
                    [doValidateRequired] => 1
                )

            [7] => stdClass Object
                (
                    [Category] => Integration
                    [Typeof] => Amazon
                    [subFields] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => HitId
                                    [ChoicesText] => MTurk HitId
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => AssignmentId
                                    [ChoicesText] => MTurk AssignmentId
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [2] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => Environment
                                    [ChoicesText] => MTurk Environment
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                        )

                    [isAltField] => 1
                )

            [8] => stdClass Object
                (
                    [Category] => Integration
                    [Typeof] => Payments
                    [subFields] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => Status
                                    [ChoicesText] => Payment Status
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => PurchaseTotal
                                    [ChoicesText] => Payment Total
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [2] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => Currency
                                    [ChoicesText] => Payment Currency
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [3] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => TransactionId
                                    [ChoicesText] => Payment Confirmation
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [4] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => MerchantType
                                    [ChoicesText] => Payment Merchant
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                        )

                    [isAltField] => 1
                )

            [9] => stdClass Object
                (
                    [Category] => System
                    [Typeof] => System
                    [subFields] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => EntryId
                                    [ChoicesText] => Entry Id
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [Typeof] => date
                                    [ColumnId] => DateCreated
                                    [ChoicesText] => Date Created
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [2] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => CreatedBy
                                    [ChoicesText] => Created By
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [3] => stdClass Object
                                (
                                    [Typeof] => date
                                    [ColumnId] => DateUpdated
                                    [ChoicesText] => Last Updated
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [4] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => UpdatedBy
                                    [ChoicesText] => Updated By
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                        )

                    [isAltField] => 1
                )

            [10] => stdClass Object
                (
                    [Category] => Integration
                    [Typeof] => IPAddresses
                    [subFields] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => IP
                                    [ChoicesText] => IP Address
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => LastPage
                                    [ChoicesText] => Last Page Accessed
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                            [2] => stdClass Object
                                (
                                    [Typeof] => text
                                    [ColumnId] => CompleteSubmission
                                    [ChoicesText] => Completion Status
                                    [DefaultVal] => 0
                                    [Price] => 0
                                )

                        )

                    [isAltField] => 1
                )

        )

    [EntryComments] => Array
        (
        )

    [integrationList] => Array
        (
        )

    [NoInstructions] => 1
    [Entries] => Array
        (
            [0] => stdClass Object
                (
                    [EntryId] => 24
                    [Field1] => Hurstmere Test
                    [Field8] => 2010-10-10
                    [Field5] => 
                    [Field2] => admin
                    [Field3] => 128 Hurstmere Road
                    [Field13] => email1@domain.com
                    [Field12] => email2@domain.com
                    [HitId] => 
                    [AssignmentId] => 
                    [Environment] => 
                    [status] => 
                    [PurchaseTotal] => 
                    [Currency] => 
                    [TransactionId] => 
                    [MerchantType] => 
                    [DateCreated] => 2010-02-24 11:53:14
                    [CreatedBy] => public
                    [DateUpdated] => 
                    [updatedBy] => 
                    [iP] => REDACTED
                    [LastPage] => 1
                    [CompleteSubmission] => 1
                )

            [1] => stdClass Object
                (
                    [EntryId] => 25
                    [Field1] => Test Person
                    [Field8] => 1111-11-11
                    [Field5] => 
                    [Field2] => admin
                    [Field3] => 128 Hurstmere Road
                    [Field13] => email1@domain.com
                    [Field12] => email2@domain.com
                    [HitId] => 
                    [AssignmentId] => 
                    [Environment] => 
                    [status] => 
                    [PurchaseTotal] => 
                    [Currency] => 
                    [TransactionId] => 
                    [MerchantType] => 
                    [DateCreated] => 2010-02-24 14:08:25
                    [CreatedBy] => public
                    [DateUpdated] => 
                    [updatedBy] => 
                    [iP] => REDACTED
                    [LastPage] => 1
                    [CompleteSubmission] => 1
                )

        )

 

I'm trying to get just the values from Field13 in the [Entries] array so I can feed them through to a simple email notifier using mail(). Could anyone help me get at them so I can turn them into a suitable string?

 

Please let me know if my question doesn't make any sense or if you need any more information.

 

Thanks so much in advance!

Link to comment
Share on other sites

Hi KrisNZ

 

Thanks so much for your help! That was enough to get me going. Just needed a slight change which I'll include below in case anyone else stumbles upon this:

 

foreach ($wuquery->form->Entries as $field_object) {
    echo $field_object->Field13.', ';
}

 

wuquery was what I was print_r'ing and the additional ->form was needed to drill down to the Field.

 

Trying to figure out how to load it into a variable now :S Thought I could do something like this, but it doesn't play nice:

 

function getEmail() {

foreach ($wuquery->form->Entries as $field_object) {

    echo $field_object->Field13.', ';

}

}

$to = getEmail();

mail($to,$subject,$message);

[code=php:0]

 

Nearly there though!

Link to comment
Share on other sites

function getEmail()

{

      foreach ($wuquery->form->Entries as $field_object)

      {

            echo $field_object->Field13.', ';

      }

      return $field_object->Field13

}

$to = getEmail();

mail($to,$subject,$message);

[code=php:0]

 

will return the last one it finds.

If you need them all, then load them into an array instead of echoing them, then process that array to send the mails

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.