I downloaded the provisioning-api, zend and php library, etc. I've changed the code to fit my domain... I'm trying to test creating multiple aliases/nicknames for existing users... when the provided php code tries with a single user, it works; the code goes to gmail, downloads a tocken, and changed/adds a nickname for that user.
Now, I'm trying the same, but I'm trying to pass the $user_name ="someusername"; taking it from a text file with one username per line... in the README sample code to create/change aliases sample code that comes with the provisioning-api-php, I changed the : $user_name = $ARGV[0]; $alias_name = "test.alias2"; and off course all the domain parameters to match mine... I also have a .sh script with this: #!/bin/bash more user_list_test.txt | xargs -l1 /usr/bin/php my_test.php which is supposed to pass the usernames (one by one) to the php code, but when I run the bash (which also runs the php), I get: #!/usr/bin/php4 -q PHP Notice: Undefined variable: ARGV in /root/provisioning-api-php/ php/my_test.php on line 31 Attempting to get token... Obtained token Giving email alias test.alias2... <?xml version="1.0" encoding="UTF-8"?> <hs:rest xmlns:hs="google:accounts:rest:protocol"><hs:status>Failure(2001)</ hs:status><hs:reason>UserDoesNotExist(1009)</ hs:reason><hs:extendedMessage>No extended message available for this error.</hs:extendedMessage><hs:result></hs:result><hs:type></hs:type></ hs:rest> #!/usr/bin/php4 -q PHP Notice: Undefined variable: ARGV in /root/provisioning-api-php/ php/my_test.php on line 31 Attempting to get token... Obtained token Giving email alias test.alias2... <?xml version="1.0" encoding="UTF-8"?> <hs:rest xmlns:hs="google:accounts:rest:protocol"><hs:status>Failure(2001)</ hs:status><hs:reason>UserDoesNotExist(1009)</ hs:reason><hs:extendedMessage>No extended message available for this error.</hs:extendedMessage><hs:result></hs:result><hs:type></hs:type></ hs:rest> etc. etc. How to tell the php code to read the usernames from an external source? I think I've tried it all, but not luck. Thanks a bunch: Code follows: :::::::::::::: get_users_jnum_test.sh :::::::::::::: #!/bin/bash more user_list_test.txt | xargs -l1 /usr/bin/php my_test.php :::::::::::::: user_list_test.txt :::::::::::::: username1 username2 username3 username4 username5 :::::::::::::: my_test.php :::::::::::::: #!/usr/bin/php4 -q <?php /** * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once("auth.php"); require_once("account.php"); require_once("alias.php"); require_once("mailing.php"); //$get_user = `sh get_users_jnum_test.sh`; //$ARGV = `more user_list_test.txt | xargs -l1 /usr/bin/php my_test.php`; /* Example user name, alias name and mailing list name for the demo. */ $user_name = $ARGV[0]; $alias_name = "test.alias2"; //$mailing_list_name = "my-list-example"; /* Get an administrator token. */ print "Attempting to get token...\n"; $token = GetAuthToken("[EMAIL PROTECTED]", "password-goes- here", "", ""); print "Obtained token $token\n\n"; /* And an email alias. */ print "Giving " . $user_name . " email alias " . $alias_name . "... \n"; print CreateAlias($token, "mydomain", $user_name, $alias_name) . "\n"; ?> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Apps APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-apps-apis?hl=en -~----------~----~----~----~------~----~------~--~---
