<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758465</guid>
        <pubDate>Thu, 01 Feb 2018 00:54:07 +0000</pubDate>
        <title>Помогите разобратся с winhttp</title>
        <link>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758465</link>
        <description><![CDATA[Hrap: с curl все заработало))))<br>
Спасибо за совет <br>
фух))) <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2018-02-01T03:58:07+03:00">01.02.18, 00:58</time></span></span><br>
но всеравно интересно что ж не так делал с winhttp]]></description>
        <author>Hrap</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758459</guid>
        <pubDate>Wed, 31 Jan 2018 20:59:50 +0000</pubDate>
        <title>Помогите разобратся с winhttp</title>
        <link>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758459</link>
        <description><![CDATA[Hrap: Ясно что ниче не ясно)))<br>Попробую curl....]]></description>
        <author>Hrap</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758448</guid>
        <pubDate>Wed, 31 Jan 2018 20:15:35 +0000</pubDate>
        <title>Помогите разобратся с winhttp</title>
        <link>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758448</link>
        <description><![CDATA[Алексей_Л: ну проблема у вас ясно не с winhttp<br>
вы сначала curl&#39;ом успешно это страничку получите<br>
и как разберётесь, почему это не работает:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">curl https://altminer.net/api/status</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
- возвращайтесь к кодингу]]></description>
        <author>Алексей_Л</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758442</guid>
        <pubDate>Wed, 31 Jan 2018 19:45:20 +0000</pubDate>
        <title>Помогите разобратся с winhttp</title>
        <link>https://forum.sources.ru/index.php?showtopic=412079&amp;view=findpost&amp;p=3758442</link>
        <description><![CDATA[Hrap: Доброго времени суток<br>
<br>
Столкнулся с следуoей проблемой <br>
Использую либу WINHTTP среда visual studio 2013 expres<br>
немогу получить ответ от сайта используя его API <br>
Посылаю  GET запрос а мне в ответ приходит  html код стартовой страницы<br>
<br>
API сайта<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">altminer.net/api/status</div></ol></div></div></div></div><br>
ответ должен быть<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;&quot;x11&quot;: {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;name&quot;: &quot;x11&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;port&quot;: 3533,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;coins&quot;: 10,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;fees&quot;: 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;hashrate&quot;: 269473938,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;workers&quot;: 5,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;estimate_current&quot;: &quot;0.00053653&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;estimate_last24h&quot;: &quot;0.00036408&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;actual_last24h&quot;: &quot;0.00035620&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;hashrate_last24h&quot;: 269473000,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;rental_current&quot;: &quot;3.61922463&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;},</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;...</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
собственно сам код<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#include &#60;windows.h&#62;</div><div class="code_line">#include &quot;winhttp.h&quot;</div><div class="code_line">#include &#60;tchar.h&#62;</div><div class="code_line">#include &#60;iostream&#62;</div><div class="code_line">&nbsp;</div><div class="code_line">std::wstring get_utf16(const std::string &amp;str, int codepage)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (str.empty()) return std::wstring();</div><div class="code_line">&nbsp;&nbsp; &nbsp;int sz = MultiByteToWideChar(codepage, 0, &amp;str[0], (int)str.size(), 0, 0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;std::wstring res(sz, 0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;MultiByteToWideChar(codepage, 0, &amp;str[0], (int)str.size(), &amp;res[0], sz);</div><div class="code_line">&nbsp;&nbsp; &nbsp;return res;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">int main()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;DWORD dwSize = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;DWORD dwDownloaded = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;LPSTR pszOutBuffer;</div><div class="code_line">&nbsp;&nbsp; &nbsp;BOOL bResults = false;</div><div class="code_line">&nbsp;&nbsp; &nbsp;HINTERNET hSession = NULL,</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;hConnect = NULL,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;hRequest = NULL;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;DWORD headersLength = -1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;wstring sdomain = get_utf16(&quot;altminer.net&quot;, CP_UTF8);</div><div class="code_line">&nbsp;&nbsp; &nbsp;wstring surl = get_utf16(&quot;/api/status&quot;, CP_UTF8);</div><div class="code_line">&nbsp;&nbsp; &nbsp;wstring additionalH = get_utf16(&quot;content-type:application/x-www-form-urlencoded&quot;, CP_UTF8);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Use WinHttpOpen to obtain a session handle.</div><div class="code_line">&nbsp;&nbsp; &nbsp;hSession = WinHttpOpen(L&quot;WinHTTP Example/1.0&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;WINHTTP_NO_PROXY_NAME,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;WINHTTP_NO_PROXY_BYPASS, 0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Specify an HTTPS server.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hSession)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;hConnect = WinHttpConnect(hSession, sdomain.c_str(),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;INTERNET_DEFAULT_HTTPS_PORT, 0);//</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Create an HTTP request handle.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hConnect)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;hRequest = WinHttpOpenRequest(hConnect, L&quot;GET&quot;, surl.c_str(),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;NULL, WINHTTP_NO_REFERER,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;WINHTTP_DEFAULT_ACCEPT_TYPES,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;WINHTTP_FLAG_SECURE);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Send a request.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hRequest)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bResults = WinHttpSendRequest(hRequest,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;additionalH.c_str(), headersLength,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;NULL, 0,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;0, 0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// End the request.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (bResults)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bResults = WinHttpReceiveResponse(hRequest, NULL);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Keep checking for data until there is nothing left.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (bResults)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;results is ok \n\r&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;do</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Check for available data.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dwSize = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!WinHttpQueryDataAvailable(hRequest, &amp;dwSize))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;Error %d no data.\n&quot;, GetLastError();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Allocate space for the buffer.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pszOutBuffer = new char[dwSize + 1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!pszOutBuffer)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;Out of memory\n&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dwSize = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Read the data.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ZeroMemory(pszOutBuffer, dwSize + 1);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!WinHttpReadData(hRequest, (LPVOID)pszOutBuffer,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dwSize, &amp;dwDownloaded))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;Error %d unable read data.\n&quot;, GetLastError();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; pszOutBuffer;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Free the memory allocated to the buffer.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;delete[] pszOutBuffer;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} while (dwSize &#62; 0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Report any errors.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (!bResults)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;Error %d unknow error.\n&quot;, GetLastError();</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// Close any open handles.</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hRequest) WinHttpCloseHandle(hRequest);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hConnect) WinHttpCloseHandle(hConnect);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (hSession) WinHttpCloseHandle(hSession);</div><div class="code_line">&nbsp;&nbsp; &nbsp;char &nbsp;in[256];</div><div class="code_line">&nbsp;&nbsp; &nbsp;cin &#62;&#62; in;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div></ol></div></div></div></div><br>
<br>
<br>
<br>
Мучаюсь третий день перегуглил кучу статей  и тем на разных форумах  :wall:   ничего не получается <br>
что делаю не так не пойму Уже и пост запросы с авторизацией посылал  и без нее  результат одинаковый html код стартовой страницы<br>
пробовал и другие сайты эффект примерно один и тот же<br>
пробовал с wininet результат тотже]]></description>
        <author>Hrap</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      </channel>
      </rss>
	