So i’ve got a CRM that i’m working with and I’m programming a class to interact with it. I’ve got it all written but it’s having 1 issue..
The return on the last function doesn’t seem to return what it’s supposed to. The code below is the class function itself, with several of the functions edited out to preserve space but many of the functions are alike.
<?php
class Limelight {
public $loginUsername = 'www.domain.com'; // your limelight API username
public $loginPassword = 'password'; // your limelight API password
public $apiDomain = 'https://www.domain.com/admin/'; // ie: https://www.mydomain.com/admin/
public $LL_Data = array();
public $postUrl = '';
function setUrl($meth = "transact") {
if ($meth == "transact") {
$this->postUrl = $this->apiDomain."transact.php?username=".$this->loginUsername."&password=".$this->loginPassword;
}
if ($meth == "membership") {
$this->postUrl = $this->apiDomain."membership.php?username=".$this->loginUsername."&password=".$this->loginPassword;
}
return $this;
}
function method ($meth = 'NewOrder') {
$this->LL_Data['method'] = $meth;
return $this;
}
function postData($data) {
$this->LL_Data .= $data;
return $this;
}
function process() {
$this->LL_Data['tranType'] = 'sale';
$this->LL_Data['ipAddress'] = $_SERVER['REMOTE_ADDR'];
$data = $this->LL_Data;
return $data;
}
}
This is currently the code, but later it’ll change as process() will have CURL added to it. And here is the utilization for it, once it’s included and initialized.
$data = $this->limelight
->setUrl('transact')
->method('NewProspect')
->campaignId('3')
->postData($_POST)
->process();
echo "<pre>";
print_r($data);
echo "</pre>";
but, when it is supposed to echo out the array all I get out is:
9rrayArray
No clue what’s going on or why it’s not working how it should. Any help appreciated.
You’re using concatenation in postData() when you probably want to use either array_merge or a plain old assignment.