[QUOTE=Dlaor-guy;35980507]Is there a reason the API asks for username/password even when requesting things guests can do, like getting the forum listing?[/QUOTE]
Maybe to prevent abuse?
[QUOTE=Dlaor-guy;35980507]Is there a reason the API asks for username/password even when requesting things guests can do, like getting the forum listing?[/QUOTE]
Just the way the API was designed. At the time, guests couldn't view threads so I didn't see the point in supporting them at all.
[QUOTE=Hexxeh;35981039]Just the way the API was designed. At the time, guests couldn't view threads so I didn't see the point in supporting them at all.[/QUOTE]
Is there a chance you'll add this ability?
[QUOTE=Hexxeh;35981039]Just the way the API was designed. At the time, guests couldn't view threads so I didn't see the point in supporting them at all.[/QUOTE]
You could at least make an official alt for the facepunch api and just enable normal browsing on it (for instance, it wouldn't be able to post), in case garry disables guests again we'd still have that.
Pocoyo did that for the mobile facepunch site in case you wouldn't want to login and it works pretty well.
Same could be done with the api, if we don't provide a login session the api will just use the alt as a guest.
Just create your own default account for you app then?
Yeah, noone will ever find out the login details if they're stored in the app!!
[QUOTE=Gran PC;35981569]Yeah, noone will ever find out the login details if they're stored in the app!![/QUOTE]
uh no?
[QUOTE=Matt-;35981127]Is there a chance you'll add this ability?[/QUOTE]
Probably not, no.
[QUOTE=DrLuke;35981596]uh no?[/QUOTE]
whoosh
Don't know if this is much used to you guys, but I figured out how to get individual posts.
[img]http://puu.sh/vbuI[/img]
[code]<?php
$url = "http://www.facepunch.com/showpost.php?p=" . $_GET["post"];
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => /*"securitytoken=" . $_GET["securitytoken"] . */"ajax=1&postid=" . $_GET["post"],
);
$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
echo $content;
?>[/code]
Just jerking around with the ajax stuff vbulletin has.
I'll see if I can discover anything cooler.
Hexxeh put the getpost method in a couple months ago
oh
didn't see it :(
[url]http://facepun.ch/requests.php[/url]
also seems like it's scraping the post from an entire page, the field "ajax=1" will return a post and only that post.
I might be wrong :v:
Yeah, don't think Hexxeh has updated that page in a while.
[editline]17th May 2012[/editline]
From your image it looks like it doesn't return ratings or the proper post number
[QUOTE=douche beat;35989054]Yeah, don't think Hexxeh has updated that page in a while.
[editline]17th May 2012[/editline]
From your image it looks like it doesn't return ratings or the proper post number[/QUOTE]
The post number is sent through the POST field, for the purpose of AJAX-refreshed pages.
Ratings can easily be attained with:
[url]http://facepunch.com/ajax.php?do=rate_list&postid=35773536[/url]
That still wouldn't return the hashes to rate a post, also i mean the post number relevant to the thread
[QUOTE=douche beat;35989123]That still wouldn't return the hashes to rate a post, also i mean the post number relevant to the thread[/QUOTE]
what are you smoking, it assumes you already know the postid and if you know the postid then you can rate the post:
[img]http://puu.sh/vbBL[/img]
It doesn't go by the hash post id, that's just the post # local to the thread.
[editline]17th May 2012[/editline]
Found ajax request that returns one word to see if a thread is opened or closed:
[img]http://puu.sh/vbCC[/img]
[img]http://puu.sh/vbCP[/img]
[code]$url = "http://www.facepunch.com/ajax.php";[/code]
[code]CURLOPT_POSTFIELDS => "do=updatethreadopen&threadid=" . $_GET["threadid"],[/code]
[QUOTE=Hentie;35989137]what are you smoking, it assumes you already know the postid and if you know the postid then you can rate the post:
[img]http://puu.sh/vbBL[/img]
It doesn't go by the hash post id, that's just the post # local to the thread.
[editline]17th May 2012[/editline]
Found ajax request that returns one word to see if a thread is opened or closed:
[img]http://puu.sh/vbCC[/img]
[img]http://puu.sh/vbCP[/img]
[code]$url = "http://www.facepunch.com/ajax.php";[/code]
[code]CURLOPT_POSTFIELDS => "do=updatethreadopen&threadid=" . $_GET["threadid"],[/code][/QUOTE]
what are you smoking
<a href="#" onclick="return RatePost( '35865162', '1', '2e2b20033b23bc2fa782abc36d0d18b7208525c1' );">
you can't rate a post without the 2e2b20033b23bc2fa782abc36d0d18b7208525c1 part
ah my bad,
forgot that each rating had a key :(
snip, fixed
IP appears to have changed again, so the API won't work until I get the new address.
can't you automatically fetch the ip from the url?
[QUOTE=DrLuke;36088399]can't you automatically fetch the ip from the url?[/QUOTE]
No, we need the non-CloudFlare one.
API is now back, and should remain that way.
[url]https://github.com/i300/FPAPI[/url]
Here's my unfinished Objective-C wrapper. Requires ARC and AFNetworking. Feel free to use it and improve upon it.
after this DDoS business i've started getting a login loop when trying to view frontpage / authenticate
i request the getforums action: "No session for that authentication information, login first to begin a session"
so i send an authenticate request, the API says everything is a success, then i try to getforums again and it fails with the same error as above. what gives?
the userid is being returned as "false" in the authentication method so thats probably the reason
[QUOTE=douche beat;36114814]the userid is being returned as "false" in the authentication method so thats probably the reason[/QUOTE]
then it seems like an api issue because nothing in my code would treat that as an issue
when was the userid entry added to the authenticate response anyway? and what is it for?
I'm seeing "Error connecting to Facepunch" at the moment, so I can't debug those issues.
Looks like a problem on FP side, need garry to take a look see what's up.
[QUOTE=Kopimi;36114905]then it seems like an api issue because nothing in my code would treat that as an issue
when was the userid entry added to the authenticate response anyway? and what is it for?[/QUOTE]
I needed it for push notifications.
[QUOTE=geel9;36119422]I needed it for push notifications.[/QUOTE]
It was added so that you can setup callbacks amongst other things. I wanted to keep the response small, and UserID is uniquely identifying. You don't really have any way of finding out who the logged-in user is, otherwise.
Sorry, you need to Log In to post a reply to this thread.