API third party Integration

Discussion in 'Troubleshooting' started by joseav, Jun 30, 2011.

  1. joseav

    joseav New Member

    Joined:
    Jun 29, 2011
    Messages:
    9
    Hello:

    I'm trying to send parameters from amember (first name and email) to third party API (autoresponder system) but send empty data, could you please help?

    I adedd this code to the file: site.inc.php

    PHP:
    function subscriberSubscribe() {

                    
    $post_parameters = array();
                    
    $post_parameters[] = "Command=Subscriber.Subscribe";
                    
    $post_parameters[] = "ResponseFormat=JSON";
                    
    $post_parameters[] = "ListID=702";
                    
    $post_parameters[] = "EmailAddress={$member['email']}";
                    
    $post_parameters[] = "IPAddress={$_SERVER['REMOTE_ADDR']}";
                    
    $post_parameters[] = "CustomField1={$member['name_f']}";

                    
    $response postData("http://www.website.com/api.php?"$post_parameters);
                    
                    if (empty(
    $response[0])) {           
                        return 
    false;
                    } else {
                        return 
    json_decode($response[1]);      
                    }
                }

    setup_plugin_hook("subscription_added""subscriberSubscribe"); 

    Thanks in Advance


    Kind Regards


    Jose
  2. joseav

    joseav New Member

    Joined:
    Jun 29, 2011
    Messages:
    9
    Hello:

    Resolved....:D

    I change to:

    PHP:
    function subscriberSubscribe($member_id$product_id,$member) {
                    
                    
    $customeremail strtolower$member['email'] );
                    
    $customername_f ucfirst(strtolower$member['name_f'] ));

                    
    $post_parameters = array();
                    
    $post_parameters[] = "Command=Subscriber.Subscribe";
                    
    $post_parameters[] = "ResponseFormat=JSON";
                    
    $post_parameters[] = "ListID=702";
                    
    $post_parameters[] = "EmailAddress=".$customeremail;
                    
    $post_parameters[] = "IPAddress={$_SERVER['REMOTE_ADDR']}";
                    
    $post_parameters[] = "CustomField1=".$customername_f;

                    
    $response postData("http://www.website.com/api.php?"$post_parameters);
                    
                    if (empty(
    $response[0])) {           
                        return 
    false;
                    } else {
                        return 
    json_decode($response[1]);      
                    }
                }

    setup_plugin_hook("subscription_added""subscriberSubscribe"); 


    Thanks

Share This Page