nz_mitch Posted February 24, 2010 Share Posted February 24, 2010 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] => [email protected] [Field12] => [email protected] [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] => [email protected] [Field12] => [email protected] [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 https://forums.phpfreaks.com/topic/193162-help-trying-to-access-field-in-stdobject/ Share on other sites More sharing options...
KrisNz Posted February 24, 2010 Share Posted February 24, 2010 Try this... foreach ($object->Entries as $field_object) { echo $field_object->Field13.'<br/>'; } Obviously replacing $object with whatever variable you print_r'd. Link to comment https://forums.phpfreaks.com/topic/193162-help-trying-to-access-field-in-stdobject/#findComment-1017197 Share on other sites More sharing options...
nz_mitch Posted February 24, 2010 Author Share Posted February 24, 2010 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 https://forums.phpfreaks.com/topic/193162-help-trying-to-access-field-in-stdobject/#findComment-1017332 Share on other sites More sharing options...
jl5501 Posted February 24, 2010 Share Posted February 24, 2010 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 https://forums.phpfreaks.com/topic/193162-help-trying-to-access-field-in-stdobject/#findComment-1017336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.