Getting script to work ..

elyobelyobelyobelyob 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

Comments

  • elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited May 3, 2005
    Gutted ... I mailed smugmug help, and they recommended posting here. I really don't have a starter for figuring out how to use the API.

    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
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 3, 2005
    Nick,

    Check ur email I sent u a reply.

    David
    David Parry
    SmugMug API Developer
    My Photos
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 4, 2005
    elyobelyob wrote:
    <!-- 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

    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
  • elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited May 5, 2005
    Thanks Don .. That was it exactly. Can't believe I overlooked the obvious!

    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?
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 6, 2005
    elyobelyob wrote:
    Thanks Don .. That was it exactly. Can't believe I overlooked the obvious!

    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
  • elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited May 6, 2005
    I'm getting there with an update of the php last5 example which I'll post when I get further in. I'm experienced with PHP, but have not really used XMLRPC before (or much similar) so a starter for ten is allowing me to understand how this all works.

    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>";
    }
Sign In or Register to comment.