Control the text in my output.
Posted: Mon Apr 04, 2011 3:43 pm
I have this code that I am using from Logmein.com that is supposed to create PIN for my customers to use. Most of the code works but there are 2 problems that come up with the output.
1. The output "stdClass Object ( [requestPINCodeResult] => requestPINCode_OK [iPINCode] => 783018 ) PIN Code." is not exactly what I want. It should say "783018 PIN Code." only.
2. The 2nd issue is this error code "Fatal error: Cannot use object of type stdClass as array in /public_html/pin.php on line 46"
From what I guess is that line 39 is the problem with item #1. How do I fix this? Line 47 seams to be my problem with item 2. Any help is greatly appreciated. Please teach me as much as possible about what is going on in this code if you can also. Thanks.
1. The output "stdClass Object ( [requestPINCodeResult] => requestPINCode_OK [iPINCode] => 783018 ) PIN Code." is not exactly what I want. It should say "783018 PIN Code." only.
2. The 2nd issue is this error code "Fatal error: Cannot use object of type stdClass as array in /public_html/pin.php on line 46"
From what I guess is that line 39 is the problem with item #1. How do I fix this? Line 47 seams to be my problem with item 2. Any help is greatly appreciated. Please teach me as much as possible about what is going on in this code if you can also. Thanks.
Code: Select all
<?php
$soapclient = new SoapClient("https://secure.logmeinrescue.com/api/api.asmx?wsdl");
//define parameters
$loginparams = array (
'sEmail' => 'email@email.com',
'sPassword' => 'password'
);
//login
$loginResult = $soapclient->login($loginparams);
//print the result
//echo "<b>Login full response.</b><br />"; //formatting
//print_r($loginResult);
//echo "<br /><br />"; //formatting
//get account info
$sCField0 = "some customer"; // Customer Name
$sCField1 = "first custom field"; //contact number
$sCField2 = "second custom field"; //order number
$sCField3 = "third custom field";
$sCField4 = "fourth custom field";
$sCField5 = "fifth custom field";
$sTracking0 = $sCField0 . date("c"); //to ensure unique
//create params array for SOAP request
$requestPINCodeParams = array(
'sCField0' => $sCField0,
'sCField1' => $sCField1,
'sCField2' => $sCField2,
'sCField3' => $sCField3,
'sCField4' => $sCField4,
'sCField5' => $sCField5,
'sTracking0' => $sTracking0
);
$requestPINCodeResult = $soapclient->requestPINCode($requestPINCodeParams);
//print out the PIN Code full response
//print_r("<b>requestPINCode full response.</b><br />");
echo "<br /><br />"; //formatting
print_r($requestPINCodeResult);
//show the PIN code only
//$PINCode = $requestPINCodeResult["iPINCode"];
//print PIN Code
print_r("<b>PIN Code.</b><br />");
print_r($iPINCode);
?>