Helpful Docs to read before posting: (All Docs) | Config Docs | General FAQ | Mailing List Sending FAQ | Error FAQ

How to trigger an invite in a PHP script?

What else do you want to hook Dada Mail to?

Re: How to trigger an invite in a PHP script?

Postby JohnA » Mon Apr 23, 2012 12:36 am

Thanks Justin,

I'm using a different address every time I test (random ones at my domain).

I added "--verbose 1" and added some PHP to spit out any output from the script, and got: -

array(4) { [0]=> string(9) "$VAR1 = {" [1]=> string(25) " 'errors' => {}," [2]=> string(23) " 'status' => 1" [3]=> string(10) " };" }


Does that shed any light? The list and email parameters were accepted as the subscription confirmation email was sent as normal, but again the profile fields were missing.
JohnA
 
Posts: 35
Joined: Wed May 26, 2010 11:36 am

Re: How to trigger an invite in a PHP script?

Postby justin » Mon Apr 23, 2012 11:06 am

That's pretty weird output - I would suggest testing it outside of the php script and debugging it from there, before including it in your php script.

The copy of the script in v5 is acting strange to me - just like you, there's no fields support. Try this copy:

https://github.com/justingit/dada-mail/ ... e_email.pl

Here's what happens with me:

Code: Select all
justin-4:subscribe justin$ ./subscribe_email.pl --list j --email test@example.com --fields first_name=John --fields last_name=Doe  --verbose
email: test@example.com
list: j
fields:
*first_name: John
*last_name: Doe
*city:
*state:
*fav_color:
*_secret:

$VAR1 = {
          'errors' => {},
          'status' => 1
        };



Checking it in the MySQL database:

Code: Select all
mysql> select * from dada_subscribers where email = 'test@example.com';
+----------+------------------+------+-----------+-------------+
| email_id | email            | list | list_type | list_status |
+----------+------------------+------+-----------+-------------+
|     8642 | test@example.com | j    | sub_confirm_list      | 1           |
+----------+------------------+------+-----------+-------------+
1 row in set (0.00 sec)
mysql> select * from dada_profile_fields where email like '%test@example.com%';
+-----------+-------------------+------------+-----------+------+-------+-----------+---------+
| fields_id | email             | first_name | last_name | city | state | fav_color | _secret |
+-----------+-------------------+------------+-----------+------+-------+-----------+---------+
|      4224 | *test@example.com | John       | Doe       | NULL | NULL  | NULL      | NULL    |
+-----------+-------------------+------------+-----------+------+-------+-----------+---------+
1 rows in set (0.00 sec)


Looks good.
User avatar
justin
 
Posts: 4580
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Re: How to trigger an invite in a PHP script?

Postby JohnA » Mon Apr 23, 2012 12:09 pm

justin wrote:The copy of the script in v5 is acting strange to me - just like you, there's no fields support. Try this copy:

https://github.com/justingit/dada-mail/ ... e_email.pl


That version worked just fine. Straight away the output looked more complete, and sure enough the extra fields were included (even the "hidden" ones).

Many thanks for sticking with this!

One final question - how do I deal with spaces in the extra field values?
JohnA
 
Posts: 35
Joined: Wed May 26, 2010 11:36 am

Re: How to trigger an invite in a PHP script?

Postby justin » Mon Apr 23, 2012 3:24 pm

Have you tried escaping them with a, "\"?


Code: Select all
justin-4:subscribe justin$ ./subscribe_email.pl --list j --email user2@example.com --fields first_name=John\ Jason --fields last_name=Doe  --verbose
email: user2@example.com
list: j
fields:
*first_name: John Jason
*last_name: Doe
*city:
*state:
*fav_color:
*_secret:

$VAR1 = {
          'errors' => {},
          'status' => 1
        };
justin-4:subscribe justin$
User avatar
justin
 
Posts: 4580
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Re: How to trigger an invite in a PHP script?

Postby JohnA » Mon Apr 23, 2012 11:56 pm

I actually tried enclosing extra fields with "", i.e: -

Code: Select all
-- fields first_name="John Jason"


and that worked :)

Thanks again for all your help!
JohnA
 
Posts: 35
Joined: Wed May 26, 2010 11:36 am

Previous

Return to Other! Integration

Who is online

Users browsing this forum: No registered users and 1 guest

Loading