My Arduino Can't Go to localhost:3000/pir

Alright I have my WiFi shield set up, running REST API.

  /* 
  This a simple example of the aREST Library for Arduino (Uno/Mega/Due/Teensy)
  using the CC3000 WiFi chip. See the README file for more details.
 
  Written in 2014 by Marco Schwartz under a GPL license. 
*/

// Import required libraries
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include <CC3000_MDNS.h>
#include <aREST.h>
#include <avr/wdt.h>

// These are the pins for the CC3000 chip if you are using a breakout board
#define ADAFRUIT_CC3000_IRQ   3
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10

#define pirPort 3000

// Create CC3000 instance  
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
                                         SPI_CLOCK_DIV2);

Adafruit_CC3000_Client client;

// Create aREST instance
aREST rest = aREST();

// Your WiFi SSID and password                                         
#define WLAN_SSID       "yourssid"
#define WLAN_PASS       "pw"
#define WLAN_SECURITY   WLAN_SEC_WPA2

#define SERVER "led.local"
#define PAGE   "/pir"
#define HOME   "localhost"

char server[] = "localhost:3000";

// The port to listen for incoming TCP connections 
#define LISTEN_PORT           80

// Server instance
Adafruit_CC3000_Server restServer(LISTEN_PORT);

// DNS responder instance
MDNSResponder mdns;

// Variables to be exposed to the API

int localpin = 6;

void setup(void)
{  
  // Start Serial
  Serial.begin(9600);
  
  // Init variables and expose them to REST API

  pinMode(6, INPUT);

  // Function to be exposed
  rest.function("state",pirStatus);
  rest.function("send",tcpSend);
  rest.function("sled",ledSend);
  
  // Give name and ID to device
  rest.set_id("008");
  rest.set_name("mighty_motion");
    
  // Set up CC3000 and get connected to the wireless network.
  if (!cc3000.begin())
  {
    while(1);
  }
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    while(1);
  }
  while (!cc3000.checkDHCP())
  {
    delay(100);
  }
  Serial.println();
  
  // Print CC3000 IP address. Enable if mDNS doesn't work
  while (! displayConnectionDetails()) {
    delay(1000);
  }
  
  // Start multicast DNS responder
  if (!mdns.begin("pir", cc3000)) {
    while(1); 
  }
   
  // Start server
  restServer.begin();
  Serial.println(F("Listening for connections..."));

  // Enable watchdog
  wdt_enable(WDTO_4S);

}

void loop() {
  
  // Handle any multicast DNS requests
  mdns.update();
  
  // Handle REST calls
  Adafruit_CC3000_ClientRef client = restServer.available();
  rest.handle(client);
  wdt_reset();

  // Check connection, reset if connection is lost
  if(!cc3000.checkConnected()){while(1){}}
  wdt_reset();
 
}

// Print connection details of the CC3000 chip
bool displayConnectionDetails(void)
{
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
  {
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
  }
  else
  {
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    Serial.println();
    return true;
  }
}

// Custom function accessible by the API
int pirStatus(String) {
  int state = digitalRead(6);
  if (state == 1) {
    Serial.print(F("Turn light on"));
  }
  if (state == 0) {
      Serial.print(F("Turn light off"));
    }
  return state;
}

int tcpSend(String) {
  unsigned long ip;
  Serial.print(F("Locating test server..."));
  cc3000.getHostByName((char *)server, &ip);
  do {
    client = cc3000.connectTCP(ip, 3000);
    Serial.print(F("Connect"));
  } while (false);
  
  if(client.connected()) {
    Serial.print(F("OK\r\nIssuing HTTP request..."));
  }
  
  if(cc3000.getHostByName("localhost", &ip)) {
    client.fastrprint(F("GET "));
    client.fastrprint(PAGE);
    client.fastrprint(F(" HTTP/1.1\r\n"));
    client.fastrprint(F("Host: ")); client.fastrprint(HOME); client.fastrprint(F("\r\n"));
    client.fastrprint(F("\r\n"));
    client.println();
    Serial.println("Should work");
  } else {
    Serial.println(F("Connection failed"));    
  }
}

int ledSend(String) {
  Serial.println("Performing HTTP GET of: ");
  Serial.println(SERVER);
  
  client.println("GET /led/1 HTTP/1.1");
  client.println("Host: ");
  client.println(SERVER);
  client.println("Connection: close");
  unsigned long ip;
  if(cc3000.getHostByName("led.local/led/1", &ip)) {
    client = cc3000.connectTCP(ip, 80);
  }
}

But I can’t get the code to print past “Locating test server…” when I want the Arduino to GET localhost:3000/pir. I just want my Arduino to GET a webpage that I set up in localhost, but I’m not sure how the functionality or the entire library works. Does anyone know what I’m doing wrong?

localhost is just valid in terms of network when you want to refer to himself.For example the pc here you have apache installed can refer to his own web page via localhost but the arduino cannot do that because the page he tries to access it’s not in arduino itself(localhost is not valid here)
In other words you must set the ip address to the pc that is running apache, IIS …

I wanted to clarify a few points before I modified anything with the code. When you say I should replace "localhost" with the ip address, how would I replace them? I have the "localhost" defined in two places: do I just type in the ip address in one of them or both of them. And I am sure the Arduino cannot read "127.0.0.1 " well unless you have a constructor or class in mind that handles long integers with decimal points as an IP address. Also, the localhost server is running on Node, not Apache.

Let me understand, you have an arduino with a service running on port 3000 and you want acess it via localhost:3000? if yes why you want to do this?

Well I'm not sure if the Arduino is running on port 3000 unless I am doing something that is a unnecessary or code-breaking. But with the shield, I have the Arduino set up as a pir sensor, and I want to use the REST API to send data from the sensor to that localhost:3000/pir which holds my database and its running code to crunch numbers.

localhost is just that. It is a local host only on that computer. http://en.wikipedia.org/wiki/Localhost

You must use the localnet ip of the server, not localhost.

Maybe a bit of study on networking might be the thing for you.