How to use cURL to get jSON data and decode the data?

I think this one will answer your question πŸ˜› $url=”https://…/api.php?action=getThreads&hash=123fajwersa&node_id=4&order_by=post_date&order=β€Œβ€‹desc&limit=1&grab_content&content_limit=1″; Using cURL // Initiate curl $ch = curl_init(); // Will return the response, if false it print the response curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Set the url curl_setopt($ch, CURLOPT_URL,$url); // Execute $result=curl_exec($ch); // Closing curl_close($ch); // Will dump a beauty json :3 var_dump(json_decode($result, true)); Using file_get_contents … Read more

Twitter API returns error 215, Bad Authentication Data

A very concise code without any other php file include of oauth etc. Please note to obtain following keys you need to sign up with https://dev.twitter.com and create application. <?php $token = ‘YOUR_TOKEN’; $token_secret=”YOUR_TOKEN_SECRET”; $consumer_key = ‘CONSUMER_KEY’; $consumer_secret=”CONSUMER_SECRET”; $host=”api.twitter.com”; $method = ‘GET’; $path=”/1.1/statuses/user_timeline.json”; // api call path $query = array( // query parameters ‘screen_name’ => … Read more

Real life trading API [closed]

AFAIK, TradeStation is the most famous of the lot. Most other trading softwares provide APIs (NinjaTrader, MetaStock etc). FWIW, there are even competitions of automated trading systems — see this. Also, this is something that the exchange has to support and your broker has to allow. Most exchanges I know of, do not allow automated … Read more

how to properly close node-express server?

app.listen() returns http.Server. You should invoke close() on that instance and not on app instance. Ex. app.get( ‘/auth/github/callback’, passport.authenticate(‘github’, { failureRedirect: ‘/login’ }), function(req, res) { res.redirect(“https://stackoverflow.com/”); setTimeout(function () { server.close(); // ^^^^^^^^^^^ }, 3000) } ); var server = app.listen(‘http://localhost:5000/’); // ^^^^^^^^^^ You can inspect sources: /node_modules/express/lib/application.js

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)