Hot answers tagged php
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 ...
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);
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 ...
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.
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
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 ...
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 ...
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