Page 6 of 8 FirstFirst ... 45678 LastLast
Results 76 to 90 of 108

Thread: XML API PHP Class version 1.0

  1. #76
    Member
    Join Date
    Mar 2004
    Posts
    104

    Default listforwards response not as documented

    Don't know if it is me and my bad English or if there are inconsistency between doc and reality when using listforwards

    Doing a
    $reply = $xmlapi->api2_query($account, "Email", "listforwards", array(domain=>$dom) );

    gives me an array:
    (
    [apiversion] => 2
    [data] => Array
    (
    [0] => Array
    (
    [dest] => info@domain1.com
    [forward] => jonas@domain2.com
    [html_dest] => info@domain1.com
    [html_forward] => jonas@domain2.com
    [uri_dest] => info%40domain1.com
    [uri_forward] => jonas%40domain2.com
    )

    [1] => Array
    (
    ...
    )

    )

    [event] => Array
    (
    [result] => 1
    )

    [func] => listforwards
    [module] => Email


    The doc say:
    <uri_dest> A string value that contains the address to which mail is forwarded in a URI encoded format.</uri_dest>
    <forward> A string value that contains the address from which mail is forwarded in plain text.</forward>
    <html_dest> A string value that contains the address to which mail is forwarded in an HTML-safe format.</html_dest>
    <uri_forward> A string value that contains the address from which mail is forwarded in a URI encoded format.</uri_forward>
    <dest> A string value that contains the address to which mail is forwarded in plain text.</dest>
    <html_forward> A string value that contains the address from which mail is forwarded in an HTML-safe format.</html_forward>

    But that is not the fact when I use it.

    dest is the original address (the from address: info@domain1.com) and forward is the destination address (jonas@domain2.com)

    Is it me, are there errors in doc or are there errors in the api?

    Btw: once again, thank you for a very much needed class

  2. #77
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default

    kjg,

    The documentation is wrong.

    It doesn't help that the key name 'dest' (short for destination) is ambigous. 'dest' should be considered the original destination, as in "all mail destined for email forum_support@domain.com will be forwarded to my_private_address@domain.com"

    'forward' = address that will receive the forwarded email.
    'dest' = original destination. email sent to this address will be propagated to another address.

    I'll let Documentation know that they need to change the prepositions for that API call.

    Many Thanks,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  3. #78
    Member
    Join Date
    May 2009
    Posts
    21

    Default

    Hi:
    I'm starting to use the API and i'm trying to list al accounts on server with this;
    PHP Code:
    include("xmlapi.php");

    $ip "here_ip_of_server";
    $root_pass "here_root_password";


    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root",$root_pass);

    $xmlapi->set_debug(1);
    print 
    $xmlapi->listaccts(); 
    And i dont get anything on page.
    If i see error_log of server i see:
    Code:
    [11-Aug-2010 10:30:05] URL: https://here_is_my_ip:2087/xml-api/listaccts
    [11-Aug-2010 10:30:05] DATA:
    [11-Aug-2010 10:30:05] Authentication Header: Authorization: Basic here_is_a_string
    
    
    [11-Aug-2010 10:30:05] RESPONSE:
    here_is_the_listacct_info
    My server has a self generated certificate for cpanel, is this the issue or i need to change anything on xmlapi.php to use it?

    Thanks in advance.

  4. #79
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default

    Hi El Chojin,

    Yes, the example code you provided, which uses the xml-api PHP client class, should work fine without any modification, regardless of your certificate.

    So, I don't understand exactly what your mean by 'page'
    And i dont get anything on page.
    Since you've removed the entirety of the RESPONSE: I can only assume there's an actual result with real information and not just an error message. So, assuming that, your issue is likely something with the way you're rendering the output of the script. Are you executing this in a web page or just on the command line?

    You could do something like
    Code:
    $results = $xmlapi->listaccts();
    var_dump($results);
    At minimum, it should return NULL if there was a programming error. If there wasn't a program error, then $result will be a SimpleXML object with either your accounts or a error message related to access or information on the cPanel server.

    What happens if you log into WHM in a browser, then go to
    Code:
    https://here_is_my_ip:2087/xml-api/listaccts
    You should get raw XML in the browser (you may have to right-click and 'view page source').

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  5. #80
    Member
    Join Date
    May 2009
    Posts
    21

    Default

    Hi:
    If i do that (store and after do the var_dump()) i see all informacion but on error log continue logging all informacion:
    Code:
    [11-Aug-2010 17:01:24] URL: https://*******:2087/xml-api/listaccts
    [11-Aug-2010 17:01:24] DATA:
    [11-Aug-2010 17:01:24] Authentication Header: Authorization: Basic *******
    
    
    [11-Aug-2010 17:01:27] RESPONSE:
     <listaccts>
      <acct>
        <disklimit>300M</disklimit>
        <diskused>24M</diskused>
        <domain>********</domain>
        <email>*********</email>
        <ip>*******</ip>
        <maxaddons>*unknown*</maxaddons>
        <maxftp>1</maxftp>
        <maxlst>1</maxlst>
        <maxparked>*unknown*</maxparked>
        <maxpop>1</maxpop>
        <maxsql>2</maxsql>
        <maxsub>1</maxsub>
        <owner>******</owner>
        <partition>home</partition>
        <plan>*********</plan>
        <shell>/usr/local/cpanel/bin/noshell</shell>
        <startdate>10 Jul 14 06:22</startdate>
        <suspended>0</suspended>
        <suspendreason>not suspended</suspendreason>
        <suspendtime></suspendtime>
        <theme>x3</theme>
        <unix_startdate>1279081336</unix_startdate>
        <user>*******</user>
      </acct>
     </listaccts>
    So i think there is an error somewhere because in other case is not normal to generate an error_log

  6. #81
    Member
    Join Date
    Apr 2005
    Posts
    74

    Default

    I cannot replicate the errors you mentioned on C46156. Works as described for me.

  7. #82
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default

    You've set your xmlapi object to debug mode. If you don't want those messages in the error_log, don't set it to 1
    Code:
    // setting to 1 will send info to PHP's error_log
    //
    // the destination of error_log() will vary: 
    //   http://php.net/manual/en/function.error-log.php
    
    // debug off, the default with creating a new xmlapi object
    $xmlapi->set_debug(0);
    
    // debug on
    $xmlapi->set_debug(1);
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  8. #83
    Member MattDees's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    DavidN did some work this past week to release 1.0.6 of this class, changes are:

    * 1.0.6:
    * Changed 'user' URL parameter for API1/2 calls to 'cpanel_xmlapi_user'/'cpanel_jsonapi_user' to resolve conflicts with API2 functions that use 'user' as a parameter
    * Relocated exmaple script to Example subdirectory
    * Modified example scripts to take remote server IP and root password from environment variables REMOTE_HOST and REMOTE_PASSWORD, respectively
    * Created subdirectory Tests for PHPUnit tests
    * Add PHPUnit test BasicParseTest.php
    Matt Dees

  9. #84
    Member
    Join Date
    Aug 2010
    Location
    Brisbane, AU
    Posts
    50

    Thumbs up Well done!

    Hi cPanel guys,

    Just wanted to use this opportunity to thank you guys for this very very helpful API PHP class. I used it now a couple of times and it works absolutely flawless for me.

    Great job! Well done! Thumbs up!

    Thanks,
    Bjorn

  10. #85
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default

    Thanks Bjorn!

    We really appreciate the kudos. I'm glad to know it's working out for you. Matt did a great job getting the authentication headers sorted out.

    I know it's not monumental in the world of coding, but this class is a true work horse I use it all the time and same tons of time with it.

    Best Regards and Thanks Again,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  11. #86
    Member
    Join Date
    May 2009
    Posts
    21

    Default

    Quote Originally Posted by cPanelDavidN View Post
    Hi El Chojin,

    Yes, the example code you provided, which uses the xml-api PHP client class, should work fine without any modification, regardless of your certificate.

    So, I don't understand exactly what your mean by 'page'


    Since you've removed the entirety of the RESPONSE: I can only assume there's an actual result with real information and not just an error message. So, assuming that, your issue is likely something with the way you're rendering the output of the script. Are you executing this in a web page or just on the command line?

    You could do something like
    Code:
    $results = $xmlapi->listaccts();
    var_dump($results);
    At minimum, it should return NULL if there was a programming error. If there wasn't a program error, then $result will be a SimpleXML object with either your accounts or a error message related to access or information on the cPanel server.

    What happens if you log into WHM in a browser, then go to
    Code:
    https://here_is_my_ip:2087/xml-api/listaccts
    You should get raw XML in the browser (you may have to right-click and 'view page source').

    Regards,
    -DavidN
    Hi:
    How can i print results without var_dump() ? if i user var_dump i see all but if i use echo i dont see anything :S

  12. #87
    Member
    Join Date
    Apr 2005
    Posts
    74

    Default

    View the page source of the blank page or parse the xml.

  13. #88
    Member
    Join Date
    May 2009
    Posts
    21

    Default

    Quote Originally Posted by hbidad View Post
    View the page source of the blank page or parse the xml.
    There is nothing on view sourcecode.

  14. #89
    Member
    Join Date
    Nov 2005
    Posts
    30

    Default

    I see there is a feature to add a pop email account, but what about to remove a pop email account?

  15. #90
    Member
    Join Date
    Mar 2004
    Posts
    104

    Default Deleting pop email account

    Quote Originally Posted by CompufixHosting View Post
    I see there is a feature to add a pop email account, but what about to remove a pop email account?
    Look at
    ApiEmail < ApiDocs/Api2 < TWiki

    There is also a delpop for api1, but api2 delpop is the recommended one

    // kjg

Page 6 of 8 FirstFirst ... 45678 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 06-04-2011, 09:52 AM
  2. XML API class works with a WHM cPanel reseller account?
    By bcosmo in forum cPanel Developers
    Replies: 1
    Last Post: 03-17-2010, 09:33 AM
  3. Install wildcard ssl using XML API class
    By tomdchi in forum cPanel Developers
    Replies: 4
    Last Post: 02-21-2010, 07:58 PM
  4. WHM XML API ready to use class
    By arash_hemmat in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 07-18-2008, 05:03 AM