user60006: i am using esp32 as a client and using following example. So here i am getting header response only that is 200. I am not getting any response after that. here is the example
#include <WiFi.h>
#include <HTTPClient.h>
 
const char* ssid = "yourNetworkName";
const char* password =  "yourPassword";
 
void setup() {
 
  Serial.begin(115200);
  delay(4000);
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }
 
  Serial.println("Connected to the WiFi network");
 
}
 
void loop() {
 
  if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
 
    HTTPClient http;
 
    http.begin("http://jsonplaceholder.typicode.com/comments?id=10"); //Specify the URL
    int httpCode = http.GET();                                        //Make the request
 
    if (httpCode > 0) { //Check for the returning code
 
        String payload = http.getString();
        Serial.println(httpCode);
        Serial.println(payload);
      }
 
    else {
      Serial.println("Error on HTTP request");
    }
 
    http.end(); //Free the resources
  }
 
  delay(10000);
 
}

given url works with me as well. but if i give other url then i am getting response as 200 only. but not receiving json data which is present on the request url.

user66695: A 200 response doesn't guarantee that your payload will actually contain any data. It depends on the server. The server might determine to respond with a 200 code but still not return any JSON code for your request.
I am not at all sure, but the server may be rejecting your request because it doesn't like your user agent. I have seen my own ESP8266 supply ESP8266HTTPClient as its user agent for HTTP requests. You can see from the source code of the HttpClient class that this is the default:
HTTPClient::HTTPClient()
    : _client(nullptr), _userAgent(F("ESP8266HTTPClient"))
{
// etc...
}

You might consider setting the user agent for your http client object:
http.setUserAgent("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0");

If you'd like to investigate a bit more, you might use curl from the command line (this works on linux) to emulate the http request being formulated by your ESP device:
curl -vA "ESP8266HTTPClient" http://jsonplaceholder.typicode.com/comments?id=10

On my linux machine, this returns all the HTTP header information, followed by some JSON for the url you've specified in your code:
[
  {
    "postId": 2,
    "id": 10,
    "name": "eaque et deleniti atque tenetur ut quo ut",
    "email": "REDACTED@EXAMPLE.COM",
    "body": "voluptate iusto quis nobis reprehenderit ipsum amet nulla\nquia quas dolores velit et non\naut quia necessitatibus\nnostrum quaerat nulla et accusamus nisi facilis"
  }
]

Maybe try that with the other url and see what comes out?
You might also modify your post with the Serial output of your sketch to provide more detail.

60006: <p>i am using esp32 as a client and using following example. So here i am getting header response only that is 200. I am not getting any response after that. here is the example</p>
<pre><code>#include &lt;WiFi.h&gt;
#include &lt;HTTPClient.h&gt;
 
const char* ssid = &quot;yourNetworkName&quot;;
const char* password =  &quot;yourPassword&quot;;
 
void setup() {
 
  Serial.begin(115200);
  delay(4000);
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println(&quot;Connecting to WiFi..&quot;);
  }
 
  Serial.println(&quot;Connected to the WiFi network&quot;);
 
}
 
void loop() {
 
  if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
 
    HTTPClient http;
 
    http.begin(&quot;http://jsonplaceholder.typicode.com/comments?id=10&quot;); //Specify the URL
    int httpCode = http.GET();                                        //Make the request
 
    if (httpCode &gt; 0) { //Check for the returning code
 
        String payload = http.getString();
        Serial.println(httpCode);
        Serial.println(payload);
      }
 
    else {
      Serial.println(&quot;Error on HTTP request&quot;);
    }
 
    http.end(); //Free the resources
  }
 
  delay(10000);
 
}
</code></pre>
<p>given url works with me as well. but if i give other url then i am getting response as 200 only. but not receiving json data which is present on the request url.</p>
 66695: <p>A 200 response doesn't guarantee that your <code>payload</code> will actually contain any data. It depends on the server. The server might determine to respond with a 200 code but still not return any JSON code for your request.</p>
<p>I am not at all sure, but the server may be rejecting your request because it doesn't like your user agent. I have seen my own ESP8266 supply ESP8266HTTPClient as its user agent for HTTP requests. You can see from the <a href="https://github.com/esp8266/Arduino/blob/52f4cc8de06671a44a27886f4df84777731cb4a6/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp" rel="nofollow noreferrer">source code</a> of the HttpClient class that this is the default:</p>
<pre><code>HTTPClient::HTTPClient()
    : _client(nullptr), _userAgent(F(&quot;ESP8266HTTPClient&quot;))
{
// etc...
}
</code></pre>
<p>You might consider setting the user agent for your http client object:</p>
<pre><code>http.setUserAgent(&quot;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0&quot;);
</code></pre>
<p>If you'd like to investigate a bit more, you might use curl from the command line (this works on linux) to emulate the http request being formulated by your ESP device:</p>
<pre><code>curl -vA &quot;ESP8266HTTPClient&quot; http://jsonplaceholder.typicode.com/comments?id=10
</code></pre>
<p>On my linux machine, this returns all the HTTP header information, followed by some JSON for the url you've specified in your code:</p>
<pre><code>[
  {
    &quot;postId&quot;: 2,
    &quot;id&quot;: 10,
    &quot;name&quot;: &quot;eaque et deleniti atque tenetur ut quo ut&quot;,
    &quot;email&quot;: &quot;REDACTED@EXAMPLE.COM&quot;,
    &quot;body&quot;: &quot;voluptate iusto quis nobis reprehenderit ipsum amet nulla\nquia quas dolores velit et non\naut quia necessitatibus\nnostrum quaerat nulla et accusamus nisi facilis&quot;
  }
]
</code></pre>
<p>Maybe try that with the other url and see what comes out?</p>
<p>You might also modify your post with the Serial output of your sketch to provide more detail.</p>
