Making a PHP script Post with Particle

I’ve been successful with posting data to my php mailto: server using the ESP8266 from sparkfun. Basically I have two pins that go high and it sends text messages from my mailto: server to a group in the database, I’m really wanting to convert this code to work with Particle rather than the ESP. I get a good compile and it works fine on the ESP so is there anyone who knows how to write these same calls using the Particle. I’ve written it 100 ways but can’t get a good compile. I’m doing something wrong but I can’t figure out what.

The code looks like this:

 :#include ESP8266WiFi.h> // you have to retag this include
:#include WifiClient.h> //retag this one too
:#include string.h> // and this one

extern "C" {
:smile: #include "user_interface.h"
uint16 readvdd33(void);
}

int inputSig = 10; //Declare input pin 10
int inputSig2 = 11; //Declare input pin 11

const char* ssid = "MyNetworkID";       //access my iphone SSID
const char* password = "MyPassword"; // Use my phone's Password

const char* host = "72.167.183.14"; // this is my Server IP 

WiFiClient client;
IPAddress ipDevice;
IPAddress ipGateway;
IPAddress ipSubnet;

void setup()
{
  pinMode(inputSig, INPUT);
  digitalWrite(inputSig, LOW);
  pinMode(inputSig2, INPUT);
  digitalWrite(inputSig2, LOW);
}

bool checkAndConnect()
{

  if (WiFi.status() != WL_CONNECTED) {
    WiFi.begin(ssid, password);
    int wifiCount = 0;
    while(WiFi.status() != WL_CONNECTED){
      delay(10);
    } 
    delay(10);
    ipDevice = WiFi.localIP();
    ipGateway = WiFi.gatewayIP();
    ipSubnet = WiFi.subnetMask();
    
    delay(10);
    return true;
  }
  return false;
}

void loop() {

  checkAndConnect();
  
  if (inputSig == HIGH)  //check pin state on 11
  {
    PostFormData();
  }
  
 else if (inputSig2 == HIGH) // check pin state 10
  {
    PostFormData2();
  }
  delay(5000);
}

void PostFormData(){

  String location = "/1/pm3/cgi/admin.cgi"; //location of the CGI script

  String cmd = "POST " + location + " HTTP/1.1\r\n"; // complete HTTP request
  cmd += "Host: shot.fm\r\n\r\n";
  cmd += "action=messanger"; //Typo? should this be messenger instead?
  cmd += "&from=admin";
  cmd += "&subject=Gunshot_Detection";
  cmd += "&by=email";
  cmd += "&body=%26%2337%26%2337firstname%26%2337%26%2337%20Go%20to%20%26%2337%26%2337homepage%26%2337%26%2337%20to%20see%20Map%20for%20shooter%20location.%20Weapon%3A%20Gunshot%20Sensor%20Detection%20is%20detected%20at%0A%26%2337%26%2337streetaddress%26%2337%26%2337%20%26%2337%26%2337city%26%2337%26%2337%20%26%2337%26%2337State%26%2337%26%2337%26%2337%26%2337quote%26%2337%26%2337%20call%20%26%2337%26%2337tel%26%2337%26%2337%20now%20for%20more%20info.%20%20Click%20here%20to%20open%20Camera.%20%5B%20http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20%5D(http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20)";
  
  IPAddress ip(72,167,183,14);
  yield();
  if(client.connect(ip, 80)){
    client.println(cmd);
    delay(10);
    client.flush();
    client.stop();
  }
}

void PostFormData2(){

  String location = "/1/pm3/cgi/admin.cgi";

  String cmd = "POST " + location + " HTTP/1.1\r\n"; // complete HTTP request
  cmd += "Host: shot.fm\r\n\r\n";
  cmd += "action=messanger"; //Typo? should this be messenger instead?
  cmd += "&from=admin";
  cmd += "&subject=Gunshot_Detection";
  cmd += "&by=email";
  cmd += "&body=%26%2337%26%2337firstname%26%2337%26%2337%20Go%20to%20%26%2337%26%2337homepage%26%2337%26%2337%20to%20see%20Map%20for%20shooter%20location.%20Weapon%3A%20Gunshot%20Sensor%20Detection%20is%20detected%20at%0A%26%2337%26%2337streetaddress%26%2337%26%2337%20%26%2337%26%2337city%26%2337%26%2337%20%26%2337%26%2337State%26%2337%26%2337%26%2337%26%2337quote%26%2337%26%2337%20call%20%26%2337%26%2337tel%26%2337%26%2337%20now%20for%20more%20info.%20%20Click%20here%20to%20open%20Camera.%20%5B%20http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20%5D(http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20)";
  
  IPAddress ip(72,167,183,14);
  yield();
  if(client.connect(ip, 80)){
    client.println(cmd);
    delay(10);
    client.flush();
    client.stop();
  }
}

Any Ideas?

Maybe it will be less trouble to rewrite it for the photon ?

#include "HttpClient/HttpClient.h"

HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
    //  { "Accept" , "application/json" },
    { "Accept" , "*/*"},
    { "content-Type", "application/x-www-form-urlencoded" },
    { NULL, NULL } // NOTE: Always terminate headers will NULL
};

http_request_t request;
http_response_t response;


void setup()
{
    PostFormData();
}

void PostFormData(){
    request.hostname = "requestb.in";
    request.port = 80;
    request.path = "/o2dfbqo2";
    request.body = "action=messanger&from=admin&subject=Gunshot_Detection&by=email";
    
    http.post(request, response, headers);
}

You can see my test posts here : http://requestb.in/o2dfbqo2?inspect

SO MUCH EASIER! I'm rewriting it now.. I was so CLOSE! So this is my new code... Thank you so much for you help!
A

:#include "HttpClient/HttpClient.h"

int inputSig1 = D1;
int inputSig2 = D2;

HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers = {
// { "Accept" , "application/json" },
{ "Accept" , "/"},
{ "content-Type", "application/x-www-form-urlencoded" },
{ NULL, NULL } // NOTE: Always terminate headers will NULL
};

http_request_t request;
http_response_t response;

void setup()

{
pinMode(inputSig1, INPUT);
digitalWrite(inputSig1, LOW)
pinMode(inputSig2, INPUT);
digitalWrite(inputSig2, LOW)

}

void loop()
{
if(inputSig1 == HIGH)
{
PostFormData();
}
if(inputSig2 == HIGH)
{
PostFormData2();
}

}

void PostFormData(){
request.hostname = "shot.fm";
request.port = 80;
request.path = "/1/pm3/cgi/admin.cgi";
request.body = "action=messanger&from=admin&subject=Gunshot_Detection&by=email&body=%26%2337%26%2337firstname%26%2337%26%2337%20Go%20to%20%26%2337%26%2337homepage%26%2337%26%2337%20to%20see%20Map%20for%20shooter%20location.%20Weapon%3A%20Gunshot%20Sensor%20Detection%20is%20detected%20at%0A%26%2337%26%2337streetaddress%26%2337%26%2337%20%26%2337%26%2337city%26%2337%26%2337%20%26%2337%26%2337State%26%2337%26%2337%26%2337%26%2337quote%26%2337%26%2337%20call%20%26%2337%26%2337tel%26%2337%26%2337%20now%20for%20more%20info.%20%20Click%20here%20to%20open%20Camera.%20%5B%20http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20%5D(http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20)";

http.post(request, response, headers);

}

void PostFormData2(){
request.hostname = "shot.fm";
request.port = 80;
request.path = "/1/pm3/cgi/admin.cgi";
request.body = "action=messanger&from=admin&subject=Detonation_Detection&by=email&body=%26%2337%26%2337firstname%26%2337%26%2337%20Go%20to%20%26%2337%26%2337homepage%26%2337%26%2337%20to%20see%20Map%20for%20shooter%20location.%20Weapon%3A%20Gunshot%20Sensor%20Detection%20is%20detected%20at%0A%26%2337%26%2337streetaddress%26%2337%26%2337%20%26%2337%26%2337city%26%2337%26%2337%20%26%2337%26%2337State%26%2337%26%2337%26%2337%26%2337quote%26%2337%26%2337%20call%20%26%2337%26%2337tel%26%2337%26%2337%20now%20for%20more%20info.%20%20Click%20here%20to%20open%20Camera.%20%5B%20http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20%5D(http%3A%2F%2Fshot.fm%2F1%2Fpm3%2Fcam.html%20)";

http.post(request, response, headers);

}