<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AG8004 Error Code while fetching market rates using php curl]]></title><description><![CDATA[<h2>I am using the following code, but I am getting following response.  Please help me out.</h2>
<h2>Response:</h2>
<p dir="auto">stdClass Object ( [success] =&gt; [message] =&gt; Invalid API Key [errorCode] =&gt; AG8004 [data] =&gt; )</p>
<hr />
<h2>Code:</h2>
<p dir="auto">$URL = "<a href="https://apiconnect.angelbroking.com/rest/secure/angelbroking/market/v1/quote/" target="_blank" rel="noopener noreferrer nofollow ugc">https://apiconnect.angelbroking.com/rest/secure/angelbroking/market/v1/quote/</a>";</p>
<pre><code>$ch = curl_init($URL);
$header = array();
$header[] = 'X-PrivateKey: '.$APIKEY_market;
$header[] = 'Accept: application/json, application/json';
$header[] = 'X-SourceID: WEB, WEB';
$header[] = 'X-ClientLocalIP: '.$_SERVER['REMOTE_ADDR'];
$header[] = 'X-ClientPublicIP: '.$_SERVER['REMOTE_ADDR'];
$header[] = 'X-MACAddress: MAC_ADDRESS';
$header[] = 'X-UserType: USER';
$header[] = 'Authorization: Bearer '.$JwtToken;
$header[] = 'Content-Type: application/json';

$str = json_encode(array("mode"=&gt;"LTP","exchangeTokens"=&gt;array("NFO"=&gt;array("150200"))));
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$rest = curl_exec($ch);
curl_close($ch);

curl_close($ch);
$result_arr = json_decode($rest);
print_r($result_arr);
</code></pre>
<hr />
]]></description><link>https://smartapi.angelone.in/smartapi/forum/topic/4185/ag8004-error-code-while-fetching-market-rates-using-php-curl</link><generator>RSS for Node</generator><lastBuildDate>Sat, 23 May 2026 17:02:12 GMT</lastBuildDate><atom:link href="https://smartapi.angelone.in/smartapi/forum/topic/4185.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 23 Dec 2023 12:51:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to AG8004 Error Code while fetching market rates using php curl on Tue, 09 Jan 2024 12:24:39 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://smartapi.angelone.in/smartapi/forum/uid/22816">@virenk1984</a></p>
<p dir="auto">Apologies for delayed response.<br />
Currently we are supporting for Node JS, Java, Python SDKs. Please reverify the API on the listed SDKs and let us know if the issue still occurs</p>
<p dir="auto">Thanks &amp; Regards,<br />
SmartAPI team</p>
]]></description><link>https://smartapi.angelone.in/smartapi/forum/post/15066</link><guid isPermaLink="true">https://smartapi.angelone.in/smartapi/forum/post/15066</guid><dc:creator><![CDATA[Moderator_2]]></dc:creator><pubDate>Tue, 09 Jan 2024 12:24:39 GMT</pubDate></item></channel></rss>