Page 4 of 8 FirstFirst ... 23456 ... LastLast
Results 46 to 60 of 109

Thread: XMLAPI php class

  1. #46
    Registered User
    Join Date
    Jun 2009
    Posts
    1

    Default

    why can not download it?

  2. #47
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Is it possible to use the API to change the error pages?

  3. #48
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by howard2009 View Post
    why can not download it?
    As far as I know, you need to be logged into the forums to download the PHP class.

  4. #49
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by jhyland87 View Post
    Is it possible to use the API to change the error pages?
    The error pages are just .shtml files in the user's directory. If you want to have default error pages, just place them in your skeleton directory and they'll be placed in all new accounts. If you want something dynamic (e.g. showing the domain name), you could use .php files instead and include a .htaccess file that instructs Apache to use those files instead.

    However, the API1 code for editing a file is:

    Code:
    <cpanel Fileman="fmsavefile($FORM{'dir'},$FORM{'file'},$FORM{'page'})">
    dir is the directory where the file should be stored (starting at the user's home directory)

    file is the name of the actual file.

    page is the actual contents of the .shtml file to be saved.

  5. #50
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Quote Originally Posted by cPanelDavidG View Post
    The error pages are just .shtml files in the user's directory. If you want to have default error pages, just place them in your skeleton directory and they'll be placed in all new accounts. If you want something dynamic (e.g. showing the domain name), you could use .php files instead and include a .htaccess file that instructs Apache to use those files instead.

    However, the API1 code for editing a file is:

    Code:
    <cpanel Fileman="fmsavefile($FORM{'dir'},$FORM{'file'},$FORM{'page'})">
    dir is the directory where the file should be stored (starting at the user's home directory)

    file is the name of the actual file.

    page is the actual contents of the .shtml file to be saved.
    I will test this later. Can I edit any files with the fmsavefile API?

  6. #51
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by jhyland87 View Post
    I will test this later. Can I edit any files with the fmsavefile API?
    Yes, but you're still bound by the system enforcement of file permissions and ownership and the files must reside within that cPanel user's home directory (e.g. /public_ftp, /, /public_html).

  7. #52
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Yes, but you're still bound by the system enforcement of file permissions and ownership and the files must reside within that cPanel user's home directory (e.g. /public_ftp, /, /public_html).
    I think I see what you mean, ill try this later, thanks!

  8. #53
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Weird, I dont get an error when I try it, but it doesnt work

    PHP Code:
    <?php
    $dir 
    '/public_html';
    $file 'test.htm';
    $page 'test';
    print 
    $xmlapi->api1_query($cpanel_un'Fileman''fmsavefile', array($dir$file$page));
    ?>
    <?xml version="1.0" ?>
    <cpanelresult>
    <module>Fileman</module>
    <func>fmsavefile</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data>
    <result></result>
    </data>
    </cpanelresult>
    See how the data and result is empty? weird

  9. #54
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by jhyland87 View Post
    Weird, I dont get an error when I try it, but it doesnt work

    PHP Code:
    <?php
    $dir 
    '/public_html';
    $file 'test.htm';
    $page 'test';
    print 
    $xmlapi->api1_query($cpanel_un'Fileman''fmsavefile', array($dir$file$page));
    ?>


    See how the data and result is empty? weird
    Correct, there is no output from this function. However, the data is saved in my tests with no entries to the error_log (which is good).

    Here's the output I get:
    [HTML]<cpanelresult>
    <module>Fileman</module>
    <func>fmsavefile</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>

    <data>
    <result/>
    </data>
    </cpanelresult>[/HTML]

  10. #55
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Correct, there is no output from this function. However, the data is saved in my tests with no entries to the error_log (which is good).

    Here's the output I get:
    [HTML]<cpanelresult>
    <module>Fileman</module>
    <func>fmsavefile</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>

    <data>
    <result/>
    </data>
    </cpanelresult>[/HTML]
    Can you tell me your code? I tried a few things, nothing works, and no error_log entries

    This time it threw an error..

    <?xml version="1.0" ?>
    <cpanelresult>
    <module>Fileman</module>
    <func>fmsavefile</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data><result>
    <fatalerror>[a fatal error or timeout occurred while processing this directive]</fatalerror>
    Last edited by jhyland87; 06-06-2009 at 07:02 PM.

  11. #56
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Here's the URL I was using in my testing:

    https://SERVER:2083/xml-api/cpanel?xmlin=<cpanelaction><module>Fileman</module><func>fmsavefile</func><apiversion>1</apiversion><args>/public_html</args><args>test.txt</args><args>file%20contents</args></cpanelaction>

  12. #57
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Here's the URL I was using in my testing:

    https://SERVER:2083/xml-api/cpanel?xmlin=<cpanelaction><module>Fileman</module><func>fmsavefile</func><apiversion>1</apiversion><args>/public_html</args><args>test.txt</args><args>file%20contents</args></cpanelaction>
    yeah that works, but why wouldnt my php api? Its damn near copy and pasted from the page in cPanel

  13. #58
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Still tinkering with it, not sure what im doing wrong

    I see in the form action it has
    PHP Code:
    <input type="hidden" name="domain" value="<cpanel print="$FORM{'domain'}">"
    But that doesnt seem to be used in the fmsavefile function, just in the links on the savefile.html..
    Last edited by jhyland87; 06-08-2009 at 03:35 PM.

  14. #59
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,307
    cPanel/WHM Access Level

    Root Administrator

    Default

    Quote Originally Posted by jhyland87 View Post
    Still tinkering with it, not sure what im doing wrong

    I see in the form action it has
    PHP Code:
    <input type="hidden" name="domain" value="<cpanel print="$FORM{'domain'}">"
    But that doesnt seem to be used in the fmsavefile function, just in the links on the savefile.html..
    Hmm, but if domain was required - then my URL wouldn't work.

    You mentioned you got a fatal error. When you get that fatal error, can you tail /usr/local/cpanel/logs/error_log and let me know what it says?

  15. #60
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Hmm, but if domain was required - then my URL wouldn't work.

    You mentioned you got a fatal error. When you get that fatal error, can you tail /usr/local/cpanel/logs/error_log and let me know what it says?
    I DID get it, cant seem to get it again.. weird.
    <cpanelresult>
    <module>Fileman</module>
    <func>fmsavefile</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data><result></result></data>
    </cpanelresult>
    Thats what it spits out, if that helps, doubt it though

Page 4 of 8 FirstFirst ... 23456 ... LastLast

Similar Threads

  1. XMLAPI Class on Git Hub
    By rmatakajr in forum cPanel Developers
    Replies: 1
    Last Post: 07-28-2011, 02:09 PM
  2. PHP xmlapi.php has been updated to version 1.0.11
    By cPanelDavidN in forum cPanel Developers
    Replies: 0
    Last Post: 06-29-2011, 04:12 PM
  3. PHP xmlapi.php has been updated to version 1.0.10
    By cPanelDavidN in forum cPanel Developers
    Replies: 0
    Last Post: 06-27-2011, 03:53 PM
  4. Strange behavior of Mysql::adddb (XMLAPI php class)
    By finitor in forum cPanel Developers
    Replies: 3
    Last Post: 05-31-2010, 04:11 AM
  5. PHP XMLAPI Docs
    By dquinney in forum cPanel Developers
    Replies: 3
    Last Post: 09-29-2007, 11:37 AM