[WebDNA] php -> WebDNA: Can I do this with [tcpconnect]?

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110731
interpreted = N
texte = This is a multipart message in MIME format. ------=_NextPart_000_0119_01CEB642.20086180 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I need to connect to a server and post some data and receive a response. I have a php template (below) as a guideline. Is this something I can replicate with [tcpconnect] and [tcpsend]? Any pointers (not sure what the curl stuff does)? Thanks, Will Here is the php version: 'limelm.feature.add', 'version_id' => $version_id, 'name' => $name, 'required' => $required ? 'true' : 'false' ); if ($type) $post_data['type'] = $type; return self::PostRequest($post_data); } public static function DeleteFeature($feature_id) { $post_data = array( 'method' => 'limelm.feature.delete', 'feature_id' => $feature_id ); return self::PostRequest($post_data); } public static function EditFeature($feature_id, $name = null, $required = null) { $post_data = array( 'method' => 'limelm.feature.edit', 'feature_id' => $feature_id ); if ($name) $post_data['name'] = $name; if ($required !== null) $post_data['required'] = $required ? 'true' : 'false'; return self::PostRequest($post_data); } public static function FindPKey($version_id, $email) { $post_data = array( 'method' => 'limelm.pkey.find', 'version_id' => $version_id, 'email' => $email ); return self::PostRequest($post_data); } public static function GeneratePKeys($version_id, $num_keys = 1, $num_acts = 1, $email = null, $feature_names = null, $feature_values = null) { $post_data = array( 'method' => 'limelm.pkey.generate', 'version_id' => $version_id, 'num_keys' => $num_keys, 'num_acts' => $num_acts ); if ($email) $post_data['email'] = $email; if ($feature_names) { $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values; } return self::PostRequest($post_data); } public static function GetPKeyDetails($pkey_id) { $post_data = array( 'method' => 'limelm.pkey.getDetails', 'pkey_id' => $pkey_id ); return self::PostRequest($post_data); } public static function GetPKeyID($version_id, $pkey) { $post_data = array( 'method' => 'limelm.pkey.getID', 'version_id' => $version_id, 'pkey' => $pkey ); return self::PostRequest($post_data); } public static function ManualActivation($xml_act_request) { $post_data = array( 'method' => 'limelm.pkey.manualActivation', 'act_req_xml' => $xml_act_request ); return self::PostRequest($post_data); } public static function SetPKeyDetails($pkey_id, $num_acts = null, $email = null, $feature_names = null, $feature_values = null) { $post_data = array( 'method' => 'limelm.pkey.setDetails', 'pkey_id' => $pkey_id ); if ($num_acts !== null) $post_data['num_acts'] = $num_acts; if ($email !== null) $post_data['email'] = $email; if ($feature_names !== null) { $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values; } return self::PostRequest($post_data); } public static function GenerateTrialExtension($version_id, $is_online, $length, $expires, $customer_id = null, $max_uses = null) { $post_data = array( 'method' => 'limelm.trialExtension.generate', 'version_id' => $version_id, 'is_online' => $is_online ? 'true' : 'false', 'length' => $length, 'expires' => $expires ); if ($is_online) $post_data['max_uses'] = $max_uses; if ($customer_id !== null) $post_data['customer_id'] = $customer_id; return self::PostRequest($post_data); } public static function TestEcho($params) { $params['method'] = 'limelm.test.echo'; return self::PostRequest($params); } private static function PostRequest($post_data) { if (!self::$api_key) throw new Exception('You must specify your LimeLM API key and set it using SetAPIKey().'); $post_data['api_key'] = self::$api_key; // This section takes the input fields and converts them to the proper format // for an http post. For example: "method=limelm.pkey.find&version_id=100" $post_string = ''; foreach ($post_data as $key => $value) { if (is_array($value)) { foreach ($value as $sub_value) { $post_string .= $key.'[]='.urlencode($sub_value).'&'; } } else $post_string .= $key.'='.urlencode($value).'&'; } $post_string = rtrim($post_string, '& '); curl_setopt(self::$request, CURLOPT_HEADER, 0); // eliminate header info from response curl_setopt(self::$request, CURLOPT_ENCODING, ""); // support gzip & deflate responses if available curl_setopt(self::$request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt(self::$request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data curl_setopt(self::$request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. return curl_exec(self::$request); // execute curl post and store results in $post_response } } ?> -- William J. Starck, DDS Big Ideas Software, LLC 1850 Keller Parkway Suite 102 Keller, TX 76248 817-431-9566 http://www.bigideasoft.com ------=_NextPart_000_0119_01CEB642.20086180 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I need to = connect to a server and post some data and receive a response. I have a = php template (below) as a guideline. Is this something I can replicate = with [tcpconnect] and [tcpsend]?

 

Any pointers = (not sure what the curl stuff does)?

 

Thanks,

 

Will

 

Here is the = php version:

 

<?php

class = LimeLM{

     private static = $api_key;

     private static = $request;

 

     public static function = SetAPIKey($api_key)

     {

           = self::$api_key =3D $api_key;

 

           = //NOTE: If you're using the self-hosted version of LimeLM (that = is,

           = //      LimeLM running on your own servers), = then replace the URL with your own.

 

           // = Almost all users should leave this line = unchanged.

           = self::$request =3D = curl_init('https://wyday.com/limelm/api/rest/');

     = }

 

     public static function = CleanUp()

     {

           // = close curl object

           = curl_close(self::$request);

     }

 

     public = static function AddFeature($version_id, $name, $required, $type =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.add',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'name' =3D> $name,

           &= nbsp;    'required' =3D> $required ? 'true' : = 'false'

           = );

 

           if = ($type)

           &= nbsp;    $post_data['type'] =3D = $type;

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = DeleteFeature($feature_id)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.delete',

           &= nbsp;    'feature_id' =3D> = $feature_id

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = EditFeature($feature_id, $name =3D null, $required =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.edit',

           &= nbsp;    'feature_id' =3D> = $feature_id

           = );

 

           if = ($name)

           &= nbsp;    $post_data['name'] =3D = $name;

 

           if = ($required !=3D=3D null)

           &= nbsp;    $post_data['required'] =3D $required ? 'true' : = 'false';

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = FindPKey($version_id, $email)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.find',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'email' =3D> $email

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GeneratePKeys($version_id, $num_keys =3D 1, $num_acts =3D 1, $email =3D = null, $feature_names =3D null, $feature_values =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.generate',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'num_keys' =3D> = $num_keys,

           &= nbsp;    'num_acts' =3D> = $num_acts

           = );

 

           if = ($email)

           &= nbsp;    $post_data['email'] =3D = $email;

 

           if = ($feature_names)

           = {

           &= nbsp;    $post_data['feature_name'] =3D = $feature_names;

           =      $post_data['feature_value'] =3D = $feature_values;

           = }

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GetPKeyDetails($pkey_id)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.getDetails',

           &= nbsp;    'pkey_id' =3D> = $pkey_id

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GetPKeyID($version_id, $pkey)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.getID',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'pkey' =3D> $pkey

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = ManualActivation($xml_act_request)

     = {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.manualActivation',

           &= nbsp;    'act_req_xml' =3D> = $xml_act_request

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = SetPKeyDetails($pkey_id, $num_acts =3D null, $email =3D null, = $feature_names =3D null, $feature_values =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.setDetails',

           &= nbsp;    'pkey_id' =3D> = $pkey_id

           = );

 

           if = ($num_acts !=3D=3D null)

           &= nbsp;    $post_data['num_acts'] =3D = $num_acts;

 

           if = ($email !=3D=3D null)

           &= nbsp;    $post_data['email'] =3D = $email;

 

           if = ($feature_names !=3D=3D null)

           = {

           &= nbsp;    $post_data['feature_name'] =3D = $feature_names;

           &= nbsp;    $post_data['feature_value'] =3D = $feature_values;

           = }

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GenerateTrialExtension($version_id, $is_online, $length, $expires, = $customer_id =3D null, $max_uses =3D null)

     = {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.trialExtension.generate',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'is_online' =3D> $is_online ? 'true' : = 'false',

           &= nbsp;    'length' =3D> = $length,

           &= nbsp;    'expires' =3D> = $expires

           = );

 

           if = ($is_online)

           &= nbsp;    $post_data['max_uses'] =3D = $max_uses;

 

           if = ($customer_id !=3D=3D null)

           &= nbsp;    $post_data['customer_id'] =3D = $customer_id;

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = TestEcho($params)

     {

           = $params['method'] =3D 'limelm.test.echo';

           = return self::PostRequest($params);

     = }

 

     private static function = PostRequest($post_data)

     {

           if = (!self::$api_key)

           &= nbsp;    throw new Exception('You must specify your = LimeLM API key and set it using SetAPIKey().');

 

           = $post_data['api_key'] =3D self::$api_key;

 

           // = This section takes the input fields and converts them to the proper = format

           // = for an http post.  For example: = "method=3Dlimelm.pkey.find&version_id=3D100"

           = $post_string =3D '';

           = foreach ($post_data as $key =3D> $value)

           = {

           &= nbsp;    if (is_array($value))

           &= nbsp;    {

           &= nbsp;         foreach ($value as = $sub_value)

           &= nbsp;         = {

           &= nbsp;           &n= bsp;   $post_string .=3D = $key.'[]=3D'.urlencode($sub_value).'&';

           &= nbsp;         = }

           &= nbsp;    }

           &= nbsp;    else

           &= nbsp;         $post_string .=3D = $key.'=3D'.urlencode($value).'&';

           = }

 

           = $post_string =3D rtrim($post_string, '& ');

 

           = curl_setopt(self::$request, CURLOPT_HEADER, 0); // eliminate header info = from response

           = curl_setopt(self::$request, CURLOPT_ENCODING, ""); // support = gzip & deflate responses if available

           = curl_setopt(self::$request, CURLOPT_RETURNTRANSFER, 1); // Returns = response data instead of TRUE(1)

           = curl_setopt(self::$request, CURLOPT_POSTFIELDS, $post_string); // use = HTTP POST to send form data

           = curl_setopt(self::$request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment = this line if you get no gateway response.

 

           = return curl_exec(self::$request); // execute curl post and store results = in $post_response

     }

}

?>

 

--

William J. = Starck, DDS

Big Ideas Software, = LLC

1850 Keller Parkway Suite = 102

Keller, TX 76248

817-431-9566

http://www.bigideasoft.com

 

------=_NextPart_000_0119_01CEB642.20086180-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? ( bob.minor@cybermill.com 2013)
  2. Re: [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? (Donovan Brooke 2013)
  3. Re: [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? (Donovan Brooke 2013)
  4. Re: [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? ("WJ Starck, DDS" 2013)
  5. Re: [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? ( bob.minor@cybermill.com 2013)
  6. [WebDNA] php -> WebDNA: Can I do this with [tcpconnect]? ("WJ Starck, DDS" 2013)
This is a multipart message in MIME format. ------=_NextPart_000_0119_01CEB642.20086180 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I need to connect to a server and post some data and receive a response. I have a php template (below) as a guideline. Is this something I can replicate with [tcpconnect] and [tcpsend]? Any pointers (not sure what the curl stuff does)? Thanks, Will Here is the php version: 'limelm.feature.add', 'version_id' => $version_id, 'name' => $name, 'required' => $required ? 'true' : 'false' ); if ($type) $post_data['type'] = $type; return self::PostRequest($post_data); } public static function DeleteFeature($feature_id) { $post_data = array( 'method' => 'limelm.feature.delete', 'feature_id' => $feature_id ); return self::PostRequest($post_data); } public static function EditFeature($feature_id, $name = null, $required = null) { $post_data = array( 'method' => 'limelm.feature.edit', 'feature_id' => $feature_id ); if ($name) $post_data['name'] = $name; if ($required !== null) $post_data['required'] = $required ? 'true' : 'false'; return self::PostRequest($post_data); } public static function FindPKey($version_id, $email) { $post_data = array( 'method' => 'limelm.pkey.find', 'version_id' => $version_id, 'email' => $email ); return self::PostRequest($post_data); } public static function GeneratePKeys($version_id, $num_keys = 1, $num_acts = 1, $email = null, $feature_names = null, $feature_values = null) { $post_data = array( 'method' => 'limelm.pkey.generate', 'version_id' => $version_id, 'num_keys' => $num_keys, 'num_acts' => $num_acts ); if ($email) $post_data['email'] = $email; if ($feature_names) { $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values; } return self::PostRequest($post_data); } public static function GetPKeyDetails($pkey_id) { $post_data = array( 'method' => 'limelm.pkey.getDetails', 'pkey_id' => $pkey_id ); return self::PostRequest($post_data); } public static function GetPKeyID($version_id, $pkey) { $post_data = array( 'method' => 'limelm.pkey.getID', 'version_id' => $version_id, 'pkey' => $pkey ); return self::PostRequest($post_data); } public static function ManualActivation($xml_act_request) { $post_data = array( 'method' => 'limelm.pkey.manualActivation', 'act_req_xml' => $xml_act_request ); return self::PostRequest($post_data); } public static function SetPKeyDetails($pkey_id, $num_acts = null, $email = null, $feature_names = null, $feature_values = null) { $post_data = array( 'method' => 'limelm.pkey.setDetails', 'pkey_id' => $pkey_id ); if ($num_acts !== null) $post_data['num_acts'] = $num_acts; if ($email !== null) $post_data['email'] = $email; if ($feature_names !== null) { $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values; } return self::PostRequest($post_data); } public static function GenerateTrialExtension($version_id, $is_online, $length, $expires, $customer_id = null, $max_uses = null) { $post_data = array( 'method' => 'limelm.trialExtension.generate', 'version_id' => $version_id, 'is_online' => $is_online ? 'true' : 'false', 'length' => $length, 'expires' => $expires ); if ($is_online) $post_data['max_uses'] = $max_uses; if ($customer_id !== null) $post_data['customer_id'] = $customer_id; return self::PostRequest($post_data); } public static function TestEcho($params) { $params['method'] = 'limelm.test.echo'; return self::PostRequest($params); } private static function PostRequest($post_data) { if (!self::$api_key) throw new Exception('You must specify your LimeLM API key and set it using SetAPIKey().'); $post_data['api_key'] = self::$api_key; // This section takes the input fields and converts them to the proper format // for an http post. For example: "method=limelm.pkey.find&version_id=100" $post_string = ''; foreach ($post_data as $key => $value) { if (is_array($value)) { foreach ($value as $sub_value) { $post_string .= $key.'[]='.urlencode($sub_value).'&'; } } else $post_string .= $key.'='.urlencode($value).'&'; } $post_string = rtrim($post_string, '& '); curl_setopt(self::$request, CURLOPT_HEADER, 0); // eliminate header info from response curl_setopt(self::$request, CURLOPT_ENCODING, ""); // support gzip & deflate responses if available curl_setopt(self::$request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt(self::$request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data curl_setopt(self::$request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. return curl_exec(self::$request); // execute curl post and store results in $post_response } } ?> -- William J. Starck, DDS Big Ideas Software, LLC 1850 Keller Parkway Suite 102 Keller, TX 76248 817-431-9566 http://www.bigideasoft.com ------=_NextPart_000_0119_01CEB642.20086180 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I need to = connect to a server and post some data and receive a response. I have a = php template (below) as a guideline. Is this something I can replicate = with [tcpconnect] and [tcpsend]?

 

Any pointers = (not sure what the curl stuff does)?

 

Thanks,

 

Will

 

Here is the = php version:

 

<?php

class = LimeLM{

     private static = $api_key;

     private static = $request;

 

     public static function = SetAPIKey($api_key)

     {

           = self::$api_key =3D $api_key;

 

           = //NOTE: If you're using the self-hosted version of LimeLM (that = is,

           = //      LimeLM running on your own servers), = then replace the URL with your own.

 

           // = Almost all users should leave this line = unchanged.

           = self::$request =3D = curl_init('https://wyday.com/limelm/api/rest/');

     = }

 

     public static function = CleanUp()

     {

           // = close curl object

           = curl_close(self::$request);

     }

 

     public = static function AddFeature($version_id, $name, $required, $type =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.add',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'name' =3D> $name,

           &= nbsp;    'required' =3D> $required ? 'true' : = 'false'

           = );

 

           if = ($type)

           &= nbsp;    $post_data['type'] =3D = $type;

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = DeleteFeature($feature_id)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.delete',

           &= nbsp;    'feature_id' =3D> = $feature_id

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = EditFeature($feature_id, $name =3D null, $required =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.feature.edit',

           &= nbsp;    'feature_id' =3D> = $feature_id

           = );

 

           if = ($name)

           &= nbsp;    $post_data['name'] =3D = $name;

 

           if = ($required !=3D=3D null)

           &= nbsp;    $post_data['required'] =3D $required ? 'true' : = 'false';

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = FindPKey($version_id, $email)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.find',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'email' =3D> $email

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GeneratePKeys($version_id, $num_keys =3D 1, $num_acts =3D 1, $email =3D = null, $feature_names =3D null, $feature_values =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.generate',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'num_keys' =3D> = $num_keys,

           &= nbsp;    'num_acts' =3D> = $num_acts

           = );

 

           if = ($email)

           &= nbsp;    $post_data['email'] =3D = $email;

 

           if = ($feature_names)

           = {

           &= nbsp;    $post_data['feature_name'] =3D = $feature_names;

           =      $post_data['feature_value'] =3D = $feature_values;

           = }

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GetPKeyDetails($pkey_id)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.getDetails',

           &= nbsp;    'pkey_id' =3D> = $pkey_id

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GetPKeyID($version_id, $pkey)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.getID',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'pkey' =3D> $pkey

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = ManualActivation($xml_act_request)

     = {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.manualActivation',

           &= nbsp;    'act_req_xml' =3D> = $xml_act_request

           = );

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = SetPKeyDetails($pkey_id, $num_acts =3D null, $email =3D null, = $feature_names =3D null, $feature_values =3D = null)

     {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.pkey.setDetails',

           &= nbsp;    'pkey_id' =3D> = $pkey_id

           = );

 

           if = ($num_acts !=3D=3D null)

           &= nbsp;    $post_data['num_acts'] =3D = $num_acts;

 

           if = ($email !=3D=3D null)

           &= nbsp;    $post_data['email'] =3D = $email;

 

           if = ($feature_names !=3D=3D null)

           = {

           &= nbsp;    $post_data['feature_name'] =3D = $feature_names;

           &= nbsp;    $post_data['feature_value'] =3D = $feature_values;

           = }

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = GenerateTrialExtension($version_id, $is_online, $length, $expires, = $customer_id =3D null, $max_uses =3D null)

     = {

           = $post_data =3D array(

           &= nbsp;    'method' =3D> = 'limelm.trialExtension.generate',

           &= nbsp;    'version_id' =3D> = $version_id,

           &= nbsp;    'is_online' =3D> $is_online ? 'true' : = 'false',

           &= nbsp;    'length' =3D> = $length,

           &= nbsp;    'expires' =3D> = $expires

           = );

 

           if = ($is_online)

           &= nbsp;    $post_data['max_uses'] =3D = $max_uses;

 

           if = ($customer_id !=3D=3D null)

           &= nbsp;    $post_data['customer_id'] =3D = $customer_id;

 

           = return self::PostRequest($post_data);

     = }

 

     public static function = TestEcho($params)

     {

           = $params['method'] =3D 'limelm.test.echo';

           = return self::PostRequest($params);

     = }

 

     private static function = PostRequest($post_data)

     {

           if = (!self::$api_key)

           &= nbsp;    throw new Exception('You must specify your = LimeLM API key and set it using SetAPIKey().');

 

           = $post_data['api_key'] =3D self::$api_key;

 

           // = This section takes the input fields and converts them to the proper = format

           // = for an http post.  For example: = "method=3Dlimelm.pkey.find&version_id=3D100"

           = $post_string =3D '';

           = foreach ($post_data as $key =3D> $value)

           = {

           &= nbsp;    if (is_array($value))

           &= nbsp;    {

           &= nbsp;         foreach ($value as = $sub_value)

           &= nbsp;         = {

           &= nbsp;           &n= bsp;   $post_string .=3D = $key.'[]=3D'.urlencode($sub_value).'&';

           &= nbsp;         = }

           &= nbsp;    }

           &= nbsp;    else

           &= nbsp;         $post_string .=3D = $key.'=3D'.urlencode($value).'&';

           = }

 

           = $post_string =3D rtrim($post_string, '& ');

 

           = curl_setopt(self::$request, CURLOPT_HEADER, 0); // eliminate header info = from response

           = curl_setopt(self::$request, CURLOPT_ENCODING, ""); // support = gzip & deflate responses if available

           = curl_setopt(self::$request, CURLOPT_RETURNTRANSFER, 1); // Returns = response data instead of TRUE(1)

           = curl_setopt(self::$request, CURLOPT_POSTFIELDS, $post_string); // use = HTTP POST to send form data

           = curl_setopt(self::$request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment = this line if you get no gateway response.

 

           = return curl_exec(self::$request); // execute curl post and store results = in $post_response

     }

}

?>

 

--

William J. = Starck, DDS

Big Ideas Software, = LLC

1850 Keller Parkway Suite = 102

Keller, TX 76248

817-431-9566

http://www.bigideasoft.com

 

------=_NextPart_000_0119_01CEB642.20086180-- "WJ Starck, DDS"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCat2 beta 11 - new prefs ... (1997) How to Display text in empty fields (1997) Country & Ship-to address & other fields ? (1997) unable to launch acgi in WebCat (1997) WebDNA Writer Needed (1997) 'does not contain' operator needed ... (1997) multi-paragraph fields (1997) Fileinfo (2001) [url] (1997) Null Characters (2005) Email within tmpl ? (1997) WebCat2b12 - nesting [tags] (1997) Buying sans cart (1997) Cache Access Error (2000) E-Mail (1998) SKU Question (1999) ShowNext Command (1997) shipcost (1997) GuestBook example (1997) WebCatalog can't find database (1997)