MahendraTanveer / phptumblr

Automatically exported from code.google.com/p/phptumblr
0 stars 0 forks source link

Getting queued posts #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Haven't found a way to get queued posts... Is there a way to do this?

thanks

Original issue reported on code.google.com by frede.pr...@gmail.com on 20 Jun 2011 at 11:17

GoogleCodeExporter commented 9 years ago
Queued posts are private, maybe the API can give them when doing an 
authentified reading. BTW phpTumblr don't do authentified reading.

Original comment by my.name....@gmail.com on 22 Jun 2011 at 10:57

GoogleCodeExporter commented 9 years ago
oh, i see... could you help me finding out the code to do this authentified 
reading, please?
i tried this, but with no success:

//Data for request
$state = "queued";
$filter = "none";

// Prepare POST request
$request_data = http_build_query(
    array(
        'email'     => $tumblr_email,
        'password'  => $tumblr_password,
        'num'       => 50,
        'state'    => $state,
        'filter'    => $filter,
    )
);

// Send the POST request (with cURL)
$c = curl_init('http://MYUSER.tumblr.com/api/read/json');

curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $request_data);

$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
var_dump($status);
// Check for success
if ($status == 200) {
    echo $result;
} else if ($status == 403) {
    echo 'Bad email or password';
} else {
    echo "Some kind of error: ".$status;
}

thanks a lot :)

Original comment by frede.pr...@gmail.com on 22 Jun 2011 at 1:57

GoogleCodeExporter commented 9 years ago
If you're getting your other posts but not the queued ones, that could mean 
that the API do not return them until they are published.

If you're facing another problem, could you tell me more about it?

Original comment by my.name....@gmail.com on 22 Jun 2011 at 2:03

GoogleCodeExporter commented 9 years ago
i get an empty object with nothing useful:

<?xml version="1.0" encoding="UTF-8"?>
<tumblr version="1.0"><tumblelog name="ttvdjs" timezone="Europe/Amsterdam" 
title="TITLE">THIS IS THE DESCRIPTION</tumblelog><posts start="0" 
total="3"/></tumblr>

this is the code i use... actually, taken from the API examples :(

//Data for request
$state = "queue";
$filter = "none";

// Prepare POST request
$request_data = http_build_query(
    array(
        'email'     => $tumblr_email,
        'password'  => $tumblr_password,
        'state'    => $state,
        'filter'    => $filter,
    )
);

// Send the POST request (with cURL)
$c = curl_init('http://ttvdjs.tumblr.com/api/read');
//$c = curl_init('http://www.tumblr.com/api/dashboard');
//$c = curl_init('http://www.tumblr.com/api/authenticate');
curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $request_data);

$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
var_dump($status);
// Check for success
if ($status == 200) {
    echo $result;
} else if ($status == 403) {
    echo 'Bad email or password';
} else {
    echo "Some kind of error: ".$status;
}

Original comment by frede.pr...@gmail.com on 22 Jun 2011 at 3:30

GoogleCodeExporter commented 9 years ago
Does your Tumblr has any published (and public) posts?

Original comment by my.name....@gmail.com on 22 Jun 2011 at 3:33

GoogleCodeExporter commented 9 years ago
Yep, 3 of them, and their number is correctly taken and given in the xml i 
get... just, i'd like to get the queued ones :)

thanks for helping me out :)

Original comment by frede.pr...@gmail.com on 23 Jun 2011 at 7:33