Tag Info

Hot answers tagged

3

Here is the relevant section of code from stack.PHP. $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_ENCODING,'gzip'); // Needed by API curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch);


3

Update 26-06-2010 PHPstack now works with SE API v0.9 and includes functions to retrieve data from StackAuth. Example of StackAuth sites function: <?php //assume $so is our PHPstack class $sites = $so->sites(); foreach($sites->body->api_sites as $site) { echo $site->name; } ?>


3

Mkay, I've only used the part of the code that relates to StackAuth: You forgot to update the version number for SitesMethod and UsersByIdAssociatedMethod SitesMethod and UsersByIdAssociatedMethod both take $key as a parameter, but seeing as we've already inited the stackPHP object with the key, seems a bit redundant. I changed my SitesMethod function to ...


3

As of this writing https://api.stackexchange.com does only allow the writing of Comments. See https://api.stackexchange.com/docs/write Starting with version 2.1, the Stack Exchange API provides limited support for writing to sites in the Stack Exchange network. There are a number of constraints imposed to prevent abuse and loss of quality on Stack ...


2

The API filters are kept pretty simple, and there is no way to restrict these answers to just accepted answers. Your app would loop through the items array and return/handle only those where is_accepted is true. Since you appear to be using PHP, the Stack.PHP library may save you time and effort, overall.


2

Anything transferred to the client and used by the client is inherently insecure. That being said, the API key can safely be divulged to the client. The only thing you need to protect is the client secret - which is only used in the explicit authentication flow. More details here: https://api.stackexchange.com/docs/authentication


2

Not sure if this is the right place for it, but I'm having some issues when I try and deploy this wrapper on a server as opposed to my local environment. First of all, I don't have SQLite3 on my server and do not have the ability to install it so I've set the caching to 0. Second, I have got it working perfectly on my local dev server that has internet ...


2

Using the wf_* functions in your code: Although the first example described the basic process of creating a widget and what is involved, I didn't go into any detail on how the widgets can interact with the environment. When your code is invoked, it is provided with a special variable 'key' that you will need to pass to all of the functions that you will ...


2

Introduction to writing widgets: Writing a widget is very simple and I'll begin by describing a simple example below. Start by logging in to your account or registering if you don't have one. Click the link at the bottom of your page that says "To design a widget, click here." Enter the details of your widget, such as its name and title. For our example ...


1

gzuncompress is for ZLIB not GZIP. The two algorithms are related, but not identical. gzuncompress isn't strictly guaranteed to decompress all ZLIB streams actually, its just guaranteed to decode the results of gzcompress. Which is honestly really weird. The appropriate function is gzdecode. If that's not available, http_inflate should also work.



Only top voted, non community-wiki answers of a minimum length are eligible