Problems with String Outputs

Hey, the following problem:

If I output this linked string, it will only be shortened or not output correctly. Why is that?

int link_id = 2;
String ip_address = "000.000.000.000";
int pin[] = {1,2,3,4,5,6};
int device_id = 1;
String url_http = "http://" + ip_address;
String url_main = url_http + "/WorkID/api/";
String url_device_id = "device_id=" + device_id;
String url_device_pin = "&device_pin=" + pin[0] + pin[1] + pin[2] + pin[3] + pin[4] + pin[5];
String url_link_id = "&link_id=" + link_id;
String url_stamping = url_main + "stamping.php?";

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.println(url_stamping + url_device_id + url_device_pin + url_link_id);
delay(4000);
}

I actually expect the following output:
-> http://000.000.000/WorkID/api/device_id=1&device_pin=123456&link_id=2

Instead I get the following output:

http://000.000.000.000/WorkID/api/stamping.php?evice_id==ink_id=

How can I fix it all?

String url_stamping = url_main + "stamping.php?";

Did you expect this line to run a php script? It can't do that.

String url_device_id = "device_id=" + device_id;

String url_device_pin = "&device_pin=" + pin[0] + pin[1] + pin[2] + pin[3] + pin[4] + pin[5];
String url_link_id = "&link_id=" + link_id;

The right-hand-side expressions in these statements do not have "String" types, and so "+" does not work for concatenation. Converting the literal (C) strings to Arduino/C++ Strings should solve one set of problems:

String url_device_id = String("device_id=") + device_id;
String url_device_pin = String("&device_pin=") + pin[0] + pin[1] + pin[2] + pin[3] + pin[4] + pin[5];
String url_link_id = String("&link_id=") + link_id;

Then you should see the various missives about how Arduino Strings cause dangerous memory fragmentation, and how it shouldn't be necessary to build a single large string before using print() anyway...

(BTW: Nice job distilling your code example down to short code that clearly demonstrates your problem!)

westfw:
The right-hand-side expressions in these statements do not have "String" types, and so "+" does not work for concatenation. Converting the literal (C) strings to Arduino/C++ Strings should solve one set of problems:

String url_device_id = String("device_id=") + device_id;

String url_device_pin = String("&device_pin=") + pin[0] + pin[1] + pin[2] + pin[3] + pin[4] + pin[5];
String url_link_id = String("&link_id=") + link_id;




Then you should see the various missives about how Arduino Strings cause dangerous memory fragmentation, and how it shouldn't be necessary to build a single large string before using print() anyway...

(BTW: Nice job distilling your code example down to short code that clearly demonstrates your problem!)

Thank you very much, it works perfectly now!

Oh, I see now. The server is going to handle the php request.