WebFaction
Community site: login faq

Trying to create a website with following code

    $sitevars = new xmlrpcmsg("create_website", array(
            new xmlrpcval($session_id, "string"),
            new xmlrpcval($app_site_name, "string"),
            new xmlrpcval(APP_BASEIP, "string"),
            new xmlrpcval(false, "boolean"),
            new xmlrpcval(array(
                $clientdomain)),
            new xmlrpcval(array(
                $app_site_name,
                "/")),  
          )
        );

Also tried:

$sitevars = new xmlrpcmsg("create_website", array(
            new xmlrpcval($session_id, "string"),
            new xmlrpcval($app_site_name, "string"),
            new xmlrpcval(APP_BASEIP, "string"),
            new xmlrpcval(false, "boolean"),
            new xmlrpcval(array(
                new xmlrpcval($clientdomain, "string"))
            ),
            new xmlrpcval(array(
                new xmlrpcval($app_site_name, "string"),
                new xmlrpcval("/", "string"))
            ),


          )
        );

Both give me a "too many values to unpack" error:

xmlrpcresp Object
(
    [val] => 0
    [valtyp] => 
    [errno] => 1
    [errstr] => :too many values to unpack
    [payload] => 
    [hdrs] => Array
        (
            [date] => Fri, 19 Dec 2014 17:11:49 GMT
            [server] => Apache
            [vary] => Cookie
            [content-length] => 317
            [content-type] => text/xml
        )

    [_cookies] => Array
        (
        )

    [content_type] => text/xml
    [raw_data] => HTTP/1.1 200 OK
Date: Fri, 19 Dec 2014 17:11:49 GMT
Server: Apache
Vary: Cookie
Content-Length: 317
Content-Type: text/xml

faultCode
1

faultString
<type 'exceptions.ValueError'>:too many values to unpack

... Is there something I'm missing? Thanks!

EDIT: Here is a dump of the object I create (obfuscated):

xmlrpcmsg Object
(
    [payload] => 
    [methodname] => create_website
    [params] => Array
        (
            [0] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [string] => 94dac30xxxxxxxxc5f94de6cf778
                        )

                    [mytype] => 1
                    [_php_class] => 
                )

            [1] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [string] => appname
                        )

                    [mytype] => 1
                    [_php_class] => 
                )

            [2] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [string] => 75.126.x.x
                        )

                    [mytype] => 1
                    [_php_class] => 
                )

            [3] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [boolean] => 
                        )

                    [mytype] => 1
                    [_php_class] => 
                )

            [4] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [string] => Array
                                (
                                    [0] => dommainname.net
                                )

                        )

                    [mytype] => 1
                    [_php_class] => 
                )

            [5] => xmlrpcval Object
                (
                    [me] => Array
                        (
                            [string] => Array
                                (
                                    [0] => appname
                                    [1] => /
                                )

                        )

                    [mytype] => 1
                    [_php_class] => 
                )

        )

    [debug] => 0
    [content_type] => text/xml
)

asked 19 Dec '14, 17:14

soca_kin
1318
accept rate: 0%

edited 22 Dec '14, 16:31


The error seems to suggest that one of the object types you are using is wrong. Have you tried the code without using variables such as $app_site_name or $clientdomain but using the raw data instead?

permanent link

answered 20 Dec '14, 00:37

johns
5.4k412
accept rate: 23%

Hi John I just tried it without any variables - all 3 variables i am using are not only appropriate types (string) but also I'm using them in other API calls (to create a subdomain, for example) and they work fine there... So I'm stumped! Any more help?

EDIT: please see above edit for the dump of the object I send...

(22 Dec '14, 15:46) soca_kin

Nearly everyone who interacts with our API does so through Python, and not PHP. Since this isn't very well-tested from PHP, the problem really could be anywhere, including within the PHP XML-RPC library you're using itself. Which PHP version and XML-RPC versions are you using?

In order to debug further, it would really help to see a full script which we can run to reproduce the problem for further investigation. Can you upload such a script to your account which we can run, and tell us where you've placed it? Also, how do you call it (from the command line? From a web application?)

(23 Dec '14, 10:27) ryans ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×265
×76
×4

question asked: 19 Dec '14, 17:14

question was seen: 2,416 times

last updated: 23 Dec '14, 10:27

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM