Getting JSON data from BTC-E

I’m trying to get some really simple looking BTC-E ticker data from and display it as it is in serial monitor.

So far I managed to get this response from the server:

Better client test 9/22/12
Send an e in serial monitor to test
HTTP/1.1 301 Moved Permanently
Server: cloudflare-nginx
Date: Wed, 05 Feb 2014 07:55:46 GMT
Content-Type: text/html
Connection: close
Set-Cookie: __cfduid=d71400cf710a583f916a26fb9906564d21391586946661; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/;; HttpOnly
Expires: Wed, 12 Feb 2014 07:55:46 GMT
Cache-Control: max-age=604800
CF-RAY: f7e0a508d840479-FRA

<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>


… the “Location:” line suggest that I’m the right place, but where is the data?

and here is the code I use. It’s a simple web client sample code witch I found on Internet.

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = ""; // web page server
EthernetClient client;


void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:

  Serial.println("Send an e in serial monitor to test"); // what to do to test

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
    byte inChar; // sets inChar as a byte
    inChar =; //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
      sendGET(); // call sendGET function below when byte is an e


void sendGET() //client function to send/receive GET request data.
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    client.println("GET /api/2/btc_usd/ticker HTTP/1.0"); //download text
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c =; //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 

  client.stop(); //stop client


I would greatly appreciate any help you can give me in working this problem.

… the “Location:” line suggest that I’m the right place, but where is the data?

Right here:

301 Moved Permanently

That suggests to me that you are NOT in the right place.

The https in the name means that you are NOT going to be able to access that site, since the Arduino with Ethernet shield does not do https (only http).