title: Pulling specific webservice with PHP from csv dump
body: <p>I have a smartertrack server, and i'm using their webservices located here <a href="http://portal.smartertools.com/services2/" rel="nofollow">http://portal.smartertools.com/services2/</a></p>
  
  <p>The old server was a Vtiger setup that is god awful, its mysql DB is convoluted and impossible to do a direct transfer without a ridiculous amount of time pairing up the equivalent tables. So i'm dumping the info and pulling the information specific that I want transferred into the new system. </p>
  
  <p>My excel dump test I have setup is as such, I do convert it into a CSV when I pull it though.</p>
  
  <p>Row 0: User Name
  Row 1: Email
  Row 2: Password
  Row 3: Phone number
  Row 4: UserID</p>
  
  <p>CreateUser2
  Adds a user to SmarterTrack without any roles. Typically, you should follow this function with one or more calls to the AddRoleToUser function.
  The Input Parameters designed by the webservices for the new server to create a user is as follows </p>
  
  <ul>
  <li>authUserName   String   Username with permissions to call this web service.</li>
  <li>authPassword   String   Password of the account used in authUserName parameter.</li>
  <li>username       String   The login username for the user.</li>
  <li>password       String   The login password for the user.</li>
  <li>email          String   The email address that should be associated to the user account.</li>
  <li>isEmailVerified   Boolean   True if the email address should be considered verified.</li>
  <li>displayName    String   The friendly name of the user (typically their full name)</li>
  </ul>
  
  <p>So when I use the following code in php CL I can upload the User to the server and into the new MySQL DB just fine. </p>
  
  <pre><code>&lt;?php
  /*
   * Usage: php createUsers.php [baseurl] [username] [password] [csvfile]
   */
  
  $baseUrl = $argv[1];
  $authUserName = $argv[2];
  $authPassword = $argv[3];
  $csvFile = $argv[4];
  
  $client = new SoapClient($baseUrl.'Services2/svcOrganization.asmx?WSDL');
  $fp = fopen($csvFile,'r') or die("Could not open $csvFile");
  while($row = fgetcsv($fp)) {
    $result = $client-&gt;createUser(array(
      'authUserName' =&gt; $authUserName,
      'authPassword' =&gt; $authPassword,
      'username' =&gt; $row[0],
      'password' =&gt; $row[4],
      'email' =&gt; $row[1],
      'isEmailVerified' =&gt; true,
      'displayName' =&gt; $row[0],
  
    ));
  }
  </code></pre>
  
  <p>That works great, no problem. So in my server when you edit User settings, you have options such as Custom Fields. </p>
  
  <p>SetUserCustomFields
  Sets the values of the provided custom field properties for the specified user.</p>
  
  <p>This webservices Input Parameters for it are as follows:</p>
  
  <ul>
  <li>authUserName   String   Username with permissions to call this web service.</li>
  <li>authPassword   String   Password of the account used in authUserName parameter.</li>
  <li>userId           Int32   The numerical ID of the user to modify.</li>
  <li>customFieldValues   String[]   The custom fields to set for the user, formatted as -'key=value' pairs. Key should be the name of the custom field, as returned by the function - GetAllCustomFields.</li>
  </ul>
  
  <p>So again, row 4 is userID in the dump file. The customFieldValues are an array, this is the code i'm using to try and pull this</p>
  
  <pre><code>&lt;?php
  /*
   * Usage: php createUsers.php [baseurl] [username] [password] [csvfile]
   */
  
  $baseUrl = $argv[1];
  $authUserName = $argv[2];
  $authPassword = $argv[3];
  $csvFile = $argv[4];
  
  $client = new SoapClient($baseUrl.'Services2/svcOrganization.asmx?WSDL');
  $fp = fopen($csvFile,'r') or die("Could not open $csvFile");
  while($row = fgetcsv($fp)) {
    $result = $client-&gt;SetUserCustomFields(array(
     'authUserName' =&gt; $authUserName,
     'authPassword' =&gt; $authPassword, 
     'userId' =&gt; $row[5],
     'customFieldValues' =&gt; array(
     'Phone' =&gt; $row[3]
  )));
  }   
  </code></pre>
  
  <p>In the server, for Custom Fields, the Field Identifier Phone has the ID of 3. (Display name would be 1, address 47, etc...)</p>
  
  <p>With that code the syntax is clear, but i'm still not pulling into the server and that has me stuck. I'm obviously aiming at the server correctly, I just don't know if my key value pair is correct.</p>