Nodejs fake referer

Nodejs 要假造一個 referer 實在太簡單了

request 抓網頁,再加個 headers 就搞定了

request({uri:'http://localhost:3000/users', headers: {referer: 'http://localhost:3000/'}}, function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body);
  }
});

完整的程式碼如下

{% include_code blog-ianwu-tw-example-master/20130817_fake_referer/client/app2.js %}

Follow 院長與芊比媽 on Google News