Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jan 2007
    Posts
    27

    Exclamation [WHM] HTTP POST to scripts2/savezone

    Hello.

    I have finally developed a php scipt for editing dns zone, for specified domain, without having direct access to whm.
    The problem is how to send variables to scripts2/savezone via http post.
    I used curl method:

    PHP Code:
    $ch curl_init(); 

    $url "http://user:password@domain.com/whm/scripts2/savezone"
    $params "&line-100-2=IN&line-200-1=NS&......"

    curl_setopt($chCURLOPT_URL,$url); 
    curl_setopt($chCURLOPT_POST1); 
    curl_setopt($chCURLOPT_POSTFIELDS,$params); 

    $resultcurl_exec ($ch); 
    curl_close ($ch); 
    And there are two results:

    1. All fields for domain become empty or
    2. WHM reports a fatal error [a fatal error or timeout occurred while processing this directive]

    How do You suggest to send the updated data to script?

    Thanks.
    Last edited by NightRider; 10-04-2007 at 11:37 AM.

  2. #2
    Member
    Join Date
    Jan 2007
    Posts
    27

    Default

    WHM developers, do you read? Answer something, please!
    What HTTP conditions does scripts2/savezone need for successfull execution of the request?

    I have also tried using access hash ( $curlheaders[0] = "Authorization: WHM user:hash"; ), but nothing

  3. #3
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Note, as /scripts2 is designed for internal use rather than being used as an API - you may not receive much of a response to this thread. Note that all functions in /scripts2 are subject to change without notice as they are only intended for internal use.

  4. #4
    Member
    Join Date
    Jan 2007
    Posts
    27

    Default

    I dont want to change the internal files. Simply I want to know how can I make the right request to /scripts2. I am able to use the remote client managing (creating, terminating, suspending etc.), but why I cant use the remote DNS managing???

  5. #5
    cPanelBilly
    Guest

    Default

    Quote Originally Posted by NightRider View Post
    I dont want to change the internal files. Simply I want to know how can I make the right request to /scripts2. I am able to use the remote client managing (creating, terminating, suspending etc.), but why I cant use the remote DNS managing???
    1) This is not a means of support so it is not up to the developers to respond through here.
    2) This is not a supported way of doing this. Most likely you are not passing the correct or all of the parameters.

  6. #6
    Member
    Join Date
    Jan 2007
    Posts
    27

    Default

    I am very very sad....

  7. #7
    Member
    Join Date
    Aug 2003
    Location
    Texas
    Posts
    91

    Default

    Quote Originally Posted by NightRider View Post
    WHM developers, do you read? Answer something, please!
    I'm not sure why I'm even helping you as no one HAS to help. This is a 100% free forum and people can post where they like. Also it is hard to troubleshoot your code as you only gave us a small part. Here is some code for you. Hopefully it helps someone else out as well...

    Code:
    <?
    
        ######### Set up basic variables here #########
    	$username = "root";
    	$password = "123456";
    	$ip = "208.74.121.52";
    	$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
    
    	//build URL here
    	$url = "http://".$username.":".$password."@".$ip.":2086/scripts2/savezone";
    
        ######### Set up all the field values here#########
    	$fields = "line-100-2=IN&";
    	$fields .= "line-200-1=NS&";
    	$fields .= "another=more&";
    	$fields .= "last_one=here";
    
    
        ######### Prepare curl settings and variables #########
    	$ch=curl_init(); 
    	curl_setopt($ch, CURLOPT_URL, $url);
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); 
    	curl_setopt($ch, CURLOPT_POST, 1); 
    	curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); 
    	curl_setopt($ch, CURLOPT_TIMEOUT, 120); 
    	curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); 
    	$buffer = curl_exec($ch);
    	curl_close($ch);
    
    ?>
    Try that and then let us know how it works. If it doesn't work...research a little more and also post ALL of your code.

  8. #8
    Member
    Join Date
    Jan 2007
    Posts
    27

    Default

    It works!
    wsenter, if You need free quality hosting, please let me know

  9. #9
    Member
    Join Date
    Aug 2003
    Location
    Texas
    Posts
    91

    Default

    Of course it works. I'm a genius . No in all seriousness I actually love developing custom applications to interact with cPanel. Now if I could only do professionally for a job

    Let me know if you need anything else. Strange as it sounds I think this stuff is fun.

Similar Threads & Tags
Similar threads

  1. Replies: 2
    Last Post: 02-08-2011, 04:12 PM
  2. post instalation problems HTTP Error 500.19
    By dethman in forum Enkompass Discussions
    Replies: 4
    Last Post: 11-02-2010, 07:49 AM
  3. HTTP POST to scripts2/savezone
    By NightRider in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-02-2007, 12:53 PM
  4. Help: WHM scripts2 not working
    By punk in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 10-20-2005, 03:52 AM
  5. WHM scripts/ and scripts2/
    By Saeven in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-04-2004, 07:33 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube