?

Log in

No account? Create an account
LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Extremely new to this. [Sep. 25th, 2004|07:39 pm]
LiveJournal Client Discussions

lj_clients

[4abudabit]
So I just started trying to use XML-RPC with LJ today, and this also will be my first time using sockets. My website is PHP based. Anyways, I coded this crappy little attempt to post a message but it doesn't work (which I expected). Could someone help me get started? Here is what I came up with:



$xmlrpc_message = "[?xml version='1.0'?]\n
[methodCall]\n
[methodName]LJ.XMLRPC.postevent[/methodName]\n
[params]\n
[param]\n
\n
[value][struct]\n
[member][name]4abudabit[/name]\n
[value][string]test[/string][/value]\n
[/member]\n
[member][name]password[/name]\n
\n
[value][string]test[/string][/value]\n
[/member]\n
[member][name]event[/name]\n
[value][string]This is a test post.\n
[/string][/value]\n
\n
[/member]\n
[member][name]subject[/name]\n
[value][string]Test[/string][/value]\n
[/member]\n
[member][name]lineendings[/name]\n

[value][string]pc[/string][/value]\n
[/member]\n
[member][name]year[/name]\n
[value][int]2002[/int][/value]\n
\n
[/member]\n
[member][name]mon[/name]\n
[value][int]7[/int][/value]\n
[/member]\n
[member][name]day[/name]\n
\n
[value][int]13[/int][/value]\n
[/member]\n
[member][name]hour[/name]\n
[value][int]20[/int][/value]\n
\n
[/member]\n
[member][name]min[/name]\n
[value][int]35[/int][/value]\n
[/member]\n
[/struct][/value]\n
\n
[/param]\n
[/params]\n
[/methodCall]";

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (socket_connect($socket, "66.150.15.140", 80)) echo "Socket connected?[BR]";


$len = strlen($xmlrpc_message);
$reply = socket_send($socket, $xmlrpc_message, $len, 0x100);
echo $reply;
socket_close($socket);

_______________________

All the ['s are of course greater and less than signs in the real code. What are some of the many problems with this attempt? Thank you.
linkReply

Comments:
[User Picture]From: 4abudabit
2004-09-27 08:58 pm (UTC)
I thought I had it figured out, but when I try login I don't get a response either:

POST /interface/xmlrpc HTTP/1.0
User-Agent: AtomicDen Test Client 1.0
Host: test.livejournal.org
Content-Type: text/xml
Content-Length: 405

[?xml version="1.0"?]
[methodCall]
[methodName]LJ.XMLRPC.login[/methodName]
[params]
[param]

[value][struct]
[member][name]username[/name]
[value][string]4abudabit[/string][/value]
[/member]

[member][name]password[/name]
[value][string]MYPASS[/string][/value]
[/member]
[member][name]ver[/name]
[value][int]0[/int][/value]
[/member]
[/struct][/value]
[/param]
[/params]
[/methodCall]
(Reply) (Parent) (Thread)