[Node.js]request
var request = require('request');
var options = {
uri: 'https://www.googleapis.com/urlshortener/v1/url',
method: 'POST',
json: {
"longUrl": "http://www.google.com/"
}
};
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body.id) // Print the shortened url.
}
});
$value = json_decode(file_get_contents('php://input'));
echo json_encode($value);
jQuery傳送json給php接收, php再傳送json回jQuery
var jsonObj = new Object();
jsonObj.one= result;
jsonObj.two= result;
require('./request')(jsonObj, postReq.recipient ,function (result) {
console.log('[videoencoder] callback request:'+result);
callback(null, 'Finished');
});
request.js
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。