Need help to GET a new accounts ID to store it in my database

37 views
Skip to first unread message

da...@successleadgenerationsystem.com

unread,
Mar 10, 2013, 3:10:12 AM3/10/13
to streamsend-...@googlegroups.com
Hi

I am VERY new to API and coding. 

I have a resellers account at Streamsend. 
When I create an account under my parent account, I need to get that new account's ID and store it into my database.
I would do that by using the email address that I just created the account with.

The only code that I could find on the internet was one similar to this one in which I changed a few bits around to see if I could make it work.
I am sure that I mucked it up pretty bad. 

 function streamsend_api_get_account_id($email){
   $account_id = variable_get('streamsend_account_id', '1');
 
   $ch = streamsend_api_prep();
   curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
 //curl_setopt($ch, CURLOPT_URL, "https://app.streamsend.com/accounts/".$account_id."/acccounts.xml?email_address=".$email);
   curl_setopt($ch, CURLOPT_URL, "https://app.streamsend.com/accounts/".$account_id."/?email_address=".$email);

 
   $response = curl_exec($ch);
 
   $xml = simplexml_load_string($response,'SimpleXMLElement',LIBXML_NOCDATA);
   $id = (string) $xml->account[0]->id;
 
   $error = streamsend_api_error($ch);
 
   return (empty($id) || $error) ? false : $id;



 $db_conn = mysql_connect('localhost','eeeeee_oooooo','xxxxxxxx');
if ( ! $db_conn )
die(mysql_error());
if ( ! mysql_select_db('admin_000000',$db_conn) )
die(mysql_error($db_conn));

mysql_query('UPDATE `tblclients` SET `ssid`=\''.mysql_real_escape_string($id,$db_conn).'\' WHERE `email`=\''.mysql_real_escape_string($email,$db_conn).'\'',$db_conn);

 }

Could someone lead me in the right direction on how to make this work? 
If this bit of code is not even close, please show me what will work.
Is there a better code that will fill my needs?

Thank You for your time and skills!!
Reply all
Reply to author
Forward
0 new messages