class curl {
var $ c;
var $ url;
function curl ($ url) {
$ this-> c = curl_init ();
//curl_setopt($this->c,CURLOPT_PROXY,'192.168.xx:8000 '); // this is a proxy (if necessary)
// curl_setopt ($ this-> c, CURLOPT_PROXYUSERPWD, 'user: pass');
// curl_setopt ($ this-> c, CURLOPT_PROXYUSERPWD, 'user2: pass2');
curl_setopt ($ this-> c, CURLOPT_COOKIE, 'cookie here'); // introduce ourselves to Google
curl_setopt ($ this-> c, CURLOPT_URL, $ url);
$ this-> url = $ url;
}
function post ($ data) {
curl_setopt ($ this-> c, CURLOPT_POST, 1);
curl_setopt ($ this-> c, CURLOPT_POSTFIELDS, $ data);
}
function go ($ return = 0) {
if ($ return) {
curl_setopt ($ this-> c, CURLOPT_RETURNTRANSFER, $ return);
$ response = curl_exec ($ this-> c);
curl_close ($ this-> c);
return $ response;
} else {
curl_exec ($ this-> c);
curl_close ($ this-> c);
}
}
} $ subscriptions = new curl ('http://www.google.com/reader/api/0/subscription/list?output=json'); {
"subscriptions": [
{
"id": "feed / http: //habrahabr.ru/rss/blog/i_am_clever/",
"title": "\ u042f \ u0443 \ ...",
"sortid": "DB54FDDE",
"categories": [
{
"id": "user / - / label / \ u0425 \ u0430 \ ...",
"label": "\ u0425 \ u0430 \ ..."
}, ...
],
"firstitemmsec": "1198498116053"
}, ...
]
}
$ items = new curl ('http://www.google.com/reader/api/0/stream/contents/'.
cm_get ('id', 'str').
'? n = 20 & r = n & xt = user /'.
$ userid. '/ state / com.google / read & ot ='.
cm_get ('ot').
'& output = json & client = scroll & ck ='. time ()); {
"id": "feed / http: //habrahabr.ru/rss/blog/linux/",
"title": "\ u0425 \ u0430 \ ...",
"self": [
{
"href": "long url"
}
],
"alternate": [
{"href": "http://habrahabr.ru/rss/blogs/linux/",
"type": "text / html"}],
"updated": 1224688061
"items": [
{
"crawlTimeMsec": "1224688061884",
"id": "tag: google.com, 2005: reader / item / 3dfa07f7c9a2dab0",
"categories": [
"user / 10093198974819760184 / state / com.google / reading-list",
"user / 10093198974819760184 / state / com.google / fresh",
"linux", "server", "java", "jboss"
],
"title": "Linux for everyone ...",
"published": 1224685301,
"updated": 1224685301,
"alternate": [{
"href": "http://habrahabr.ru/blogs/linux/42958/",
"type": "text / html"}],
"summary": {
"direction": "ltr",
"content": "many letters"
},
"author": "Kaaboeld",
"annotations": [],
"origin": {
"streamId": "feed / http: //habrahabr.ru/rss/blog/linux/",
"title": "\ u0425 \ u0430 ...",
"htmlUrl": "http://habrahabr.ru/rss/blogs/linux/"
}
}, ...
]
}
// start of UNIX times
var adate = new Date ('1970/01/01');
// remove minutes of local time
adate.addMinutes (- (new Date) .getTimezoneOffset ());
// add the seconds that Google sent
adate.addSeconds (Math.floor (x.items [i] .crawlTimeMsec / 1000));
$ x = new curl ('http://www.google.com/reader/api/0/unread-count?all=true&output=json');
{unread:
{
"max": 1000,
"unreadcounts": [
{
"id": "feed / http: //bash.org.ru/rss/",
"count": 764,
"newestItemTimestampUsec": "1223899958891011"
}, ...
]
}
}
$ x = new curl ('http://www.google.com/reader/api/0/mark-all-as-read?client=scroll');
$ x-> post ('T ='. $ T. // token
'& s ='. $ feed. // feed id
//'&t=asd'.//$_POST [° 'title' [>)]. // optional parameter
'& ts ='. time () // time
);
$ x = new curl ('http://www.google.com/reader/api/0/token?ck='.time ().' & client = scroll '); $ x = new curl ('http://www.google.com/reader/api/0/edit-tag?client=scroll');
$ x-> post ('T ='. cm_post ('token', 'str').
'& a = user /'.$ userid.' / state / com.google / read '.
'& async = true'.
'& i ='. $ items [$ i]. // id of the item
'& s ='. $ feeds [$ i]); // id tape
Source: https://habr.com/ru/post/42961/
All Articles