This is the 2 parts of the code (line 108 is the last line of NoBlankFunctions.php): It seems 2me that everything is fine. It is a declaration of the $responder with newReposnderOAuth (can assume that this class works good, as it is used by many other clients of that company). Than at some point the code is calling to addNewUser, which a part of NoBlankFunctions. Inside this func there is a call to responder, another function in the same php file. And in it's end it collapses when trying to send the http request.
include 'OAuth.php';
include 'responder_sdk.php';
include 'NoBlankFunctions.php';
$client_key = '28FB957EA00B920BE7F83A365CC7ABAF';
$client_secret = '0B06B5A69DB0F3BCB80A716031C2DE6C';
$user_key = '1F566B1DE821BE68B5F485F75610F610';
$user_secret = '5D1406DACCA6B862AD4AE361823BB108';
$responder = new ResponderOAuth($client_key, $client_secret, $user_key, $user_secret);
.
.
.
addNewUser($registerFirstName, $registerLastName, $registerUserName,
$registerPass, $registerEmail, $registerGender,
$registerAge, $registerCountry, "Heb", $registerUserGMT);
noBlankFunctions.php
function addNewUser($registerFirstName, $registerLastName, $registerUserName,
$registerPass, $registerEmail, $registerGender,
$registerAge, $registerCountry, $registerLang, $registerUserGMT)
{
global $db;
$sql = "INSERT INTO `".$db."`.`users` (`userEmail`, `nickName`, `password`, `firstName`, `lastName`, `State`, `userGMT`, `language`, `gender`, `age`, `currentDay`, `dateForCurrentDay`, `isUserCheck`, `isUserDone`, `isUserPayed`)
VALUES ('".$registerEmail."', '".$registerUserName."', '".$registerPass."', '".$registerFirstName."', '".$registerLastName."', '".$registerCountry."', '".$registerUserGMT."', '".$registerLang."', '".$registerGender."', '".$registerAge."', '0', '".date("Y/m/d")."', '0', '0', '0');";
$result = mysql_query($sql);
if ($registerLang == 'En')
{
$listNum = 37742;
}
elseif($registerGender == 'Male')
{
$listNum = 37713;
}
else
{
$listNum = 37741;
}
responder($registerEmail, $registerFirstName, $listNum);
}
function responder($userMail, $userFirstName, $listNum)
{
$post_data = array(
'subscribers' => json_encode(
array(
array(
'EMAIL' => $userMail,
'NAME' => $userFirstName
)
)
)
);
$response = $responder->http_request('lists/'.$listNum.'/subscribers', 'post', $post_data);
}
Any ideas?
The error message is saying that $responder is not an object, in other words, it has not been instantiated; trying to access the method http_request of non-object is then obviously not going to work.
I noticed that you instantiated $responder
, but then you try to reference $responder
from inside the function responder
in the file noBlankFunctions.php
. I feel like you are referencing the local scope of that $responder
variable, which is not an object. If you tried declaring $responder
with a global pre-fix that should reference the original $responder variable you instantiated above.
gloabl $responder
$responder
is not defined inside the scope of the function.
Either (in order from most to least preferable) pass it as an additional argument, or add global $responder
somewhere in the function body (before attempting to access it), or access $GLOBALS['responder']
.