0

I'm creating a lightweight opt-out/profile center using the the Fuel SDK. My method is to use the email address a person inputs to retrieve the subscriber's ID. This ID will then be used to either update their profile with a new email address or unsubscribe them based on their selections in the form.

The problem is that when I retrieve a subscriber using the retrieve code for Fuel, I can't seem to assign the pertinent data to an actual variable. For instance:

$subscriber = new ET_Subscriber(); //Retrieve
$subscriber->authStub = $myclient;
$subscriber->props = array('EmailAddress', 'ID');
$subscriber->filter = array('Property' => 'EmailAddress','SimpleOperator' =>  'equals','Value' => example@example.com);
$response = $subscriber->get();

The code above will retrieve the subscriber info for the subscriber with example@exmaple.com as their email. But what I need to do is assign the ID number of this selected subscriber to a variable. But the object type in $response is ET_Get which tells me it cannot be treated as an array. So how does one go about actually accessing the data so that I can make this pseudo code work:

$idNumber = $response->ID;

Any ideas? Thanks in advance!

0

if you do a

print_r($response);

You'll see that there is a attribute "responses", each of which contains an ID

Ie. $response->responses[0]->ID

You have to check - $response->responses is not empty - $response->responses may be more than one. The same email address can be stored under different subscriber ids

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.