API question when connecting to PAP

Avatar image
Jan 18, 2013
Markus wrote
Hi,
we are connecting to PAP through API to add an affiliate. We are using the code below and it worked just fine but all of a sudden it stopped working and getting this error:

Error while communicating with PAP: RPC Execution exception: 'Row username does not exist

But we did not change anything on the script. PLEASE HELP! This is urgent. Thanks, Markus

////////////////////////

require(($_SERVER[DOCUMENT_ROOT]).'/partner/api/PapApi.class.php');

// login to API

$session = new Gpf_Api_Session("http://www.menschenspezialisten.com/partner/scripts/server.php");
if(!$session->login("username", "password")) {
// cannot login to API, do something with the error
die("API call error: ".$e->getMessage());
}

$affiliate = new Pap_Api_Affiliate($session);
$affiliate->setUsername("$email");
$affiliate->setFirstname("$firstname");
$affiliate->setLastname("$lastname");
//$affiliate->setStreet("$row[street]");
//$affiliate->setCity("$row[city]");
//$affiliate->setZip("$row[zip]");
//$affiliate->setCountry("$row[country]");
$affiliate->setRefid("$refid");
$affiliate->setParentUserId("$row[9]");
$affiliate->setStatus("A");
$affiliate->setPassword("$password");

try {
if ($affiliate->add()) {
echo "Affiliate saved successfuly";
echo "
";
// Save UserID back to MSP
$papuserid = $affiliate->getUserid();
echo "Affiliate ".$papuserid." loaded
";
echo "Address ID ".$addressID." ";
$sql="UPDATE msp_addresses SET sponsorID='$sponsorID', papID='$papuserid' WHERE addressID=$addressID";
mysql_query($sql,$con);
$sql="UPDATE msp_partnerreg SET papprocessed=NOW() WHERE addressID=$addressID";
mysql_query($sql,$con);

} else {
die("Cannot save affiliate: ".$affiliate->getMessage());
}
} catch (Exception $e) {
die("Error while communicating with PAP: ".$e->getMessage());
}

Edited by Andrej Harsani on Apr 07, 2013, 03:40 AM
Reply
2 Answers
Avatar image
Jan 18, 2013
Markus wrote
never mind, we figured it out
Avatar image
Apr 06, 2013
Gregtampa wrote
well gee thanks for explaining on how you figured it out...

problem is you dont have the soap etention with your php.
Look up the following inside your script file

phpinfo();
If you can't find Soap Client set to enabled

Do the following:

Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
Remove the ; from the beginning of extension=php_soap.dll
Restart your Apache server
Look up your phpinfo(); again and check if you see a similar picture to the one above
If you do, problem solved!