Getting script to work ..
elyobelyob
Registered Users Posts: 53 Big grins
<!-- Converted from text/plain format -->
Hi there, I'm trying to get the PHP example script to work (last5.php). However am unsure at what to change to make it work. I know this probably isn't supported by yourselves, but a starter for ten would be useful. Just a basic example script to show how to login and upload a picture or browse a directory would be ideal.
Firstly, I edited xmlrpc.inc as I was receiving the error "Fatal error: Cannot redeclare xmlrpc_decode() in /home/central/public_html/smugmug/xmlrpc/xmlrpc.inc on line 1380". So I commented out the two functions.
Now, I get
Fault: Code: 1 Reason: invalid login
Warning: Invalid argument supplied for foreach() in /home/central/public_html/smugmug/last5.php on line 22
Warning: rsort() expects parameter 1 to be array, null given in /home/central/public_html/smugmug/last5.php on line 32
Warning: array_splice(): The first argument should be an array in /home/central/public_html/smugmug/last5.php on line 33
Warning: Invalid argument supplied for foreach() in /home/central/public_html/smugmug/last5.php on line 37
This is having tried
$nick = 'user';
$password = ''; // have tried both my API key & my smugmug password with no luck.
$version = '1.0';
Any help to get started is appreciated.
Thanks
Nick
Hi there, I'm trying to get the PHP example script to work (last5.php). However am unsure at what to change to make it work. I know this probably isn't supported by yourselves, but a starter for ten would be useful. Just a basic example script to show how to login and upload a picture or browse a directory would be ideal.
Firstly, I edited xmlrpc.inc as I was receiving the error "Fatal error: Cannot redeclare xmlrpc_decode() in /home/central/public_html/smugmug/xmlrpc/xmlrpc.inc on line 1380". So I commented out the two functions.
Now, I get
Fault: Code: 1 Reason: invalid login
Warning: Invalid argument supplied for foreach() in /home/central/public_html/smugmug/last5.php on line 22
Warning: rsort() expects parameter 1 to be array, null given in /home/central/public_html/smugmug/last5.php on line 32
Warning: array_splice(): The first argument should be an array in /home/central/public_html/smugmug/last5.php on line 33
Warning: Invalid argument supplied for foreach() in /home/central/public_html/smugmug/last5.php on line 37
This is having tried
$nick = 'user';
$password = ''; // have tried both my API key & my smugmug password with no luck.
$version = '1.0';
Any help to get started is appreciated.
Thanks
Nick
0
Comments
I thought I'd done a lot of the problems. Now I feel that the 'hackers' are being very protective. I honestly want to just get a start.
If being protective is the key, then I'm gutted.
Please email me at newsprofile@gmail.com with some help.
Thanks,
Nick
Check ur email I sent u a reply.
David
SmugMug API Developer
My Photos
I found your XML submissions and took a quick look. Everything looks fine, except your password seems to be incorrect. I just checked - the password you're sending doesn't match your account.
I think that's the only problem.
Don
However the last5.php example is now out of date and took a bit or work to get parts of it working. I'll post a copy of some the edited code in a while.
Is it xmlrpc or REST that is the preferred medium - are they both going to be used for the forseeable future?
Both will continue to be developed, we're not phasing either out. Who knows, pigs might fly and we'll have a SOAP interface at some point, too.
Sometime down the road, I hope to have both be officially supported, but unless you have a business contract with us, that's currently not the case. They're "as-is" and meant for tinkerers and early adopters.
Don
On my debug, I can see the results, but cannot pull the information using xmlrpc_decode. Am I using the followin, but cannot echo out any of the responses, but can see the values in the debug. Once I've got this bit, then I'll be off on my own, just need to make sure I have the basics sorted!
Thanks
$get_sesid_msg = new xmlrpcmsg('smugmug.login.withPassword', $login_struct);
$ses_id = $xmlrpc_client->send($get_sesid_msg, '0', 'https');
if (!$ses_id) { die("send failed"); }
$ses_id_v = $ses_id->value();
if (!$ses_id->faultCode()) {
$id_array = xmlrpc_decode($ses_id_v);
$user_id = $id_array;
$session_id = $id_array;
$password_hash = $id_array;
echo "Logged in<br>" . $session_id."-".$user_id."-".$password_hash."<br>";
} else {
print "Fault: ";
print "Code: " . $ses_id->faultCode() . " Reason '" .$ses_id->faultString()."'<br>";
}