What's the PHP code to use the statuses/update api?

Asked by michaelmorriss

Is this the script to use the statuses/update api?

<?php

$username = 'jiskousername';
$password = 'jiskopass';
$message = 'Hello peepz, Im developing a plugin for jisko';
$url = 'http://yourserver/api/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "update=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

//curl_close($tw);

?>

Could you show me an example please?
I would like to develop a plugin for Jisko.

Thank you,
Michael

P.S. I love Jisko, keep up the great work and thank you for the polite and quick answers!

Question information

Language:
English Edit question
Status:
Solved
For:
Jisko Edit question
Assignee:
No assignee Edit question
Solved by:
michaelmorriss
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Marcos Garcia (marcosgdf) said :
#1

It should work. Did you try it?

Thanks!!!

On Thu, May 13, 2010 at 3:06 PM, michaelmorriss <
<email address hidden>> wrote:

> New question #110861 on Jisko:
> https://answers.launchpad.net/jisko/+question/110861
>
> Is this the script to use the statuses/update api?
>
> <?php
>
>
> $username = 'jiskousername';
> $password = 'jiskopass';
> $message = 'Hello peepz, Im developing a plugin for jisko';
> $url = 'http://yourserver/api/statuses/update.xml';
> $curl_handle = curl_init();
> curl_setopt($curl_handle, CURLOPT_URL, "$url");
> curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
> curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($curl_handle, CURLOPT_POST, 1);
> curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "update=$message");
> curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
> $buffer = curl_exec($curl_handle);
> curl_close($curl_handle);
>
> //curl_close($tw);
>
> ?>
>
> Could you show me an example please?
> I would like to develop a plugin for Jisko.
>
>
> Thank you,
> Michael
>
>
>
> P.S. I love Jisko, keep up the great work and thank you for the polite and
> quick answers!
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
michaelmorriss (mrxqware) said :
#2

yes I've tried it, but it doesn't work for me.

(I'm translating Jisko to dutch at the moment :) )

Revision history for this message
michaelmorriss (mrxqware) said :
#3

Could you try it?

Revision history for this message
Pats (pats) said :
#4

Marcos,

I tried but not working.... tested with admin username & pass and another user...

One finding:

i added below as last line of the above code:
echo $buffer;

and i got the message:
/api/statuses/update.xml Could not authenticate you.

Also if you put the url http://yourserver/api/statuses/update.xml on your browser it asks for username & password
i tried giving username & passwords but it doesn't accept.

So there's something wrong in the Authentication process.

Thanks,
Pats

Revision history for this message
michaelmorriss (mrxqware) said :
#5

I've found the "problem"

You need your jisko username and api for the Authentication process.

This is the code:

<?php

$username = 'jiskousername';
$password = 'jiskoapi';
$message = 'Hello peepz, Im developing a plugin for jisko';
$url = 'http://yourserver/api/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

//curl_close($tw);

?>

Revision history for this message
michaelmorriss (mrxqware) said :
#6

"The user api code"

Revision history for this message
michaelmorriss (mrxqware) said :
#7

Is there a way to use the jisko password?

because I don't think people would like to login with their api code as password.

Revision history for this message
Marcos Garcia (marcosgdf) said :
#8

"Jisko API it's a twitter-like API, but there's a difference between them:
Jisko API uses an API code instead of a password, this results in more
security, so that foreign people can't get your password and then manipulate
your account (deleting it, changing the password or whatever)."

On Thu, May 13, 2010 at 8:33 PM, michaelmorriss <
<email address hidden>> wrote:

> Question #110861 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/110861
>
> Status: Solved => Open
>
> michaelmorriss is still having a problem:
> Is there a way to use the jisko password?
>
> because I don't think people would like to login with their api code as
> password.
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
Pats (pats) said :
#9

ah yes... my mistake.. with api need the api key :p

but i'm now getting error:

/api/statuses/update.xml Client must provide a 'status' parameter with a value.

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message"); should put the value to status....

whats missing now....

Thanks,
Pats

Revision history for this message
Pats (pats) said :
#10

Micheal... is it working for u?

Revision history for this message
Marcos Garcia (marcosgdf) said :
#11

Oh, that should be a mistake. If you have a look at:

http://wiki.jisko.org/w/Statuses/update

then you'll see that you have to pass update=thetext instead of
status=thetext

Sorry!

On Thu, May 13, 2010 at 9:22 PM, Pats
<email address hidden>wrote:

> Question #110861 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/110861
>
> Pats requested for more information:
> Micheal... is it working for u?
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
michaelmorriss (mrxqware) said :
#12

Yes it does work for me.

<?php
$username = 'jiskousername';
$userapi = 'jiskouserapi';
$message = 'Hello peepz, Im developing a plugin for jisko';
$url = 'http://yourserver/api/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
//curl_close($tw);
?>

Revision history for this message
Pats (pats) said :
#13

yes!!! it works with status=$message :)

Thanks,
Pats

Revision history for this message
Marcos Garcia (marcosgdf) said :
#14

so..?

On Thu, May 13, 2010 at 10:19 PM, Pats <<email address hidden>
> wrote:

> Question #110861 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/110861
>
> Pats posted a new comment:
> yes!!! it works with status=$message :)
>
> Thanks,
> Pats
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
michaelmorriss (mrxqware) said :
#15

There is no question anymore.

Thank you for your help Marcos!