XML-RPC , YouTube , <name> tag

#1
[eluser]ezafy[/eluser]
I am new to php and xml-rpc and I spend like 4 hours on this so far and no luck yet Sad
youtube requires request like this:
Code:
&lt;?xml version='1.0'?&gt;
<methodCall>
    <methodName>youtube.users.get_profile</methodName>
        <params>
            <param><value><struct>
                <member>
                    <name>dev_id</name>
                    <value><string>YOUR_DEV_ID</string></value>
                </member>
                <member>
                    <name>user</name>
                    <value><string>YOUTUBE_USER_NAME</string></value>
                </member>
            </struct></value></param>
        </params>
</methodCall>

but whatever i do I can not get CI's xml-rpc to produce the <name> tag

what is wrong with my code or is it not possible?


Code:
&lt;?php

class Welcome extends Controller {

    function Welcome()
    {
        
        parent::Controller();        
        $this->load->library('xmlrpc');    
    }
    
    function index()
    {
        $this->xmlrpc->set_debug(TRUE);
        $this->xmlrpc->server('http://www.youtube.com/api2_xmlrpc');
        $this->xmlrpc->method('youtube.users.get_profile');
        $request = array(                  
                  "dev_id" => array('My_DEV_ID', 'string'),
                  "user" => array('My_USER_ID', 'string')                  
                  #  array('user', 'string'),
                  #  array('dev_id', 'string')
                   );    
        $this->xmlrpc->request($request);
        $this->xmlrpc->display_response();

        if(! $this->xmlrpc->send_request())
        {
            echo $this->xmlrpc->display_error();  
        }

    }
}
?&gt;
THANK YOU VERY MUCH

#2
[eluser]Chris Newton[/eluser]
Code:
$request = array(array("dev_id"    =>    array('My_DEV_ID', 'string'),
                       "user"      =>    array('My_USER_ID', 'string')
                       ),
                 struct);


Looks like you're missing the data type of your request.

#3
[eluser]ezafy[/eluser]
first of all, thanks for looking @ my code Smile
BUT the problem still persists
I am trying to send a request to youtube's XML-RPC server
not send a reponse to a client according to CI's docs what you suggested
(using struct) is used when constructing a response to a request!

I also tried
Code:
$request = array(
                          array(
                                  "dev_id"    =>    array('mydevid', 'string'),
                                  "user"      =>    array('myuserid', 'string')
                                  ));
and
Code:
$request = array(
                          array(
                                  "dev_id"    =>    'mydevid',
                                  "user"      =>    'myuserid'
                                  ));
and
Code:
$request = array(
                                  "dev_id"    =>    'mydevid',
                                  "user"      =>    'myuserid'
                                  );
but none of them work Sad

#4
[eluser]ezafy[/eluser]
:lol: got it to work like so:
Code:
$request = array(
                  array( array("user" => array('my_user_name', 'string') ,
                                "dev_id" => array('my_dev_id', 'string')  )
                         , 'struct')  ,                        
                         );


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.