client.println() not taking the string stored in String Class

I am developing a project on Intel Edison Arduino Kit. As part of my project I am using the WiFi.h lib to talk to wireless IP camera. However I am stuck with the following issue and don't know what the fix is.

If I pass the string to the client.println() it works perfectly fine. But when I store the same string into a String Class and pass that to client.println() it does not work. I have also tried client.print() instead but that does not work either.

Appreciate any help.

e.g.
Working Case:

if (client.connect(server, 80)) {
client.println(GET /get_status.cgi?user=admin&pwd=sunday HTTP/1.0);
client.println("Host: ");
client.println("Connection: close");
client.println();
while (client.available()) { //connected or data available
char c = client.read();
Serial.write(c);
}
client.stop(); // stop client

Not working :

String value;
value = "GET /get_status.cgi?user=admin&pwd=sunday HTTP/1.0";

if (client.connect(server, 80)) {
client.println(value);
client.println("Host: ");
client.println("Connection: close");
client.println();
while (client.available()) { //connected or data available
char c = client.read();
Serial.write(c);
}
client.stop(); // stop client

client.println(GET /get_status.cgi?user=admin&pwd=sunday HTTP/1.0);

Are you telling us that that even compiles?

Please remember to use code tags when posting code

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the "Code" icon above the posting area. It is the first icon, with the symbol: </>

Read this before posting a programming question

How to use this forum

client.println("Host: ");

That is nonsense, too. In both codes.

I agree with PaulS. That is like saying:

Hi! My name is:

niravpatel85:
Appreciate any help.

In the "working" code you possibly didn't mean:

client.println(GET /get_status.cgi?user=admin&pwd=sunday HTTP/1.0);

but you meant:

client.println("GET /get_status.cgi?user=admin&pwd=sunday HTTP/1.0");

Literal string constants have to be included in double quotes.

And about the "not working" code: BOTH codes are wrong!

You cannot expect that the first character of the server response is already available for reading from the Ethernet shield, one microsecond after you sent the last character of the request header to the server.

Wrong programming logic in both cases.

Perhaps the code with sending a nullterminated string is just working because your server is very fast, your server starts responding before the request is actually finished and because nullterminated strings are very effective and fast while the "String" object class is ineffective and slow.

Under normal circumstances I'd say: Both codes are wrong because of a wrong programming logic. The HTTP protocol has a recommended default timeout of something like 30 seconds or so. So in a worst case scenario you can expect that it lasts up to 30 seconds after sending a file request to a webserver until you get the server response.