<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Получение данных со страницы сайта в переменную]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9681&amp;type=atom" />
	<updated>2014-06-07T13:51:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9681</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83737#p83737" />
			<content type="html"><![CDATA[<p>Ну, если нужен универсальный код, то надо узнавать. Странно вообще-то, что там выше cp1252 сработало. Если русские буквы, то должно быть cp1251.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-07T13:51:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83737#p83737</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83736#p83736" />
			<content type="html"><![CDATA[<p>Тогда здесь крякозябры <span class="bbu">Url = http://www.microsoft.com</span>.<br />Может как то так узнавать кодировку:<br /></p><div class="codebox"><pre><code>
Url = http://site.ru/file.txt
Url = http://www.script-coding.com/WSH.html
Url = http://www.microsoft.com
 
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;) 
HTTP.Open(&quot;GET&quot;, Url) 
HTTP.Send()   

Body := HTTP.ResponseBody
pArr := ComObjValue(Body)
cBytes := NumGet(pArr+0, A_PtrSize = 8? 24:16, &quot;uint&quot;)
pText := NumGet(pArr+0, A_PtrSize = 8? 16:12, &quot;ptr&quot;) 

RegexMatch(HTTP.ResponseText, &quot;`nmi)&lt;meta.*?charset=&quot;&quot;*(?&lt;Set&gt;.*?)&quot;&quot;.*?&gt;&quot;, Char)   
Encode := CharSet = &quot;windows-1251&quot; ? &quot;cp1251&quot; : CharSet

MsgBox, % StrGet(pText, cBytes, Encode)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-06-07T13:12:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83736#p83736</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83732#p83732" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>А если так?<br /></p><div class="codebox"><pre><code>
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
Body := HTTP.ResponseBody
pArr := ComObjValue(Body)
cBytes := NumGet(pArr+0, A_PtrSize = 8? 24:16, &quot;uint&quot;)
pText := NumGet(pArr+0, A_PtrSize = 8? 16:12, &quot;ptr&quot;)
MsgBox, % StrGet(pText, cBytes, &quot;cp1252&quot;)
</code></pre></div></blockquote></div><p>Ты великолепен! Все работает как надо! Спасибо большое!</p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-07T12:30:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83732#p83732</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83731#p83731" />
			<content type="html"><![CDATA[<p>А если так?<br /></p><div class="codebox"><pre><code>
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
Body := HTTP.ResponseBody
pArr := ComObjValue(Body)
cBytes := NumGet(pArr+0, A_PtrSize = 8? 24:16, &quot;uint&quot;)
pText := NumGet(pArr+0, A_PtrSize = 8? 16:12, &quot;ptr&quot;)
MsgBox, % StrGet(pText, cBytes, &quot;cp1252&quot;)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-07T12:22:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83731#p83731</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83730#p83730" />
			<content type="html"><![CDATA[<p>Вот такие иероглифы. Если поможет, вот ссылка на файл <a href="http://vkontackte.tk/NoDelete/base.php">http://vkontackte.tk/NoDelete/base.php</a></p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-07T12:17:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83730#p83730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83729#p83729" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>tuma4ok пишет:</cite><blockquote><p>Ни что из выше сказанных не помогло! Либо ничего нету, либо опять иероглифы.</p></blockquote></div><p>Какие именно иероглифы? Показать можете?</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-07T12:02:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83729#p83729</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83728#p83728" />
			<content type="html"><![CDATA[<p>Дело в том, что здесь:<br /></p><div class="codebox"><pre><code>
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
MsgBox, % HTTP.ResponseText
</code></pre></div><p>у меня нормальные русские буквы.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-06-07T11:48:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83728#p83728</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83727#p83727" />
			<content type="html"><![CDATA[<p>Ни что из выше сказанных не помогло! Либо ничего нету, либо опять иероглифы.</p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-07T11:43:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83727#p83727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83726#p83726" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>По какой например ссылке.</p></blockquote></div><p>По такой же.</p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-07T11:39:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83726#p83726</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83725#p83725" />
			<content type="html"><![CDATA[<p>Вот у меня тоже что-то не получается.<br />Что упустил?<br /></p><div class="codebox"><pre><code>HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;https://trust-host.ru/&quot;)
HTTP.SetRequestHeader(&quot;Accept-Language&quot;, &quot;ru&quot;)
HTTP.SetRequestHeader(&quot;Accept-Charset&quot;,&quot;Windows-1251&quot;)
HTTP.setRequestHeader(&quot;Content-Language&quot;, &quot;ru&quot;)
HTTP.setRequestHeader(&quot;Content-Charset&quot;, &quot;Windows-1251&quot;)
HTTP.setRequestHeader(&quot;Content-Type&quot;,&quot;application/x-www-form-urlencoded; charset=Windows-1251&quot;)
HTTP.Send()
MsgBox, % HTTP.ResponseText</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-06-07T11:09:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83725#p83725</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83724#p83724" />
			<content type="html"><![CDATA[<p>Проблема в кодировке, видимо. Не знаю, можно ли её как-то явно задать. А &quot;через дыру в заборе&quot; можно так (для кодировки utf-8):<br /></p><div class="codebox"><pre><code>
HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
Body := HTTP.ResponseBody
pArr := ComObjValue(Body)
cBytes := NumGet(pArr+0, A_PtrSize = 8? 24:16, &quot;uint&quot;)
pText := NumGet(pArr+0, A_PtrSize = 8? 16:12, &quot;ptr&quot;)
MsgBox, % StrGet(pText, cBytes, &quot;utf-8&quot;)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-07T10:09:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83724#p83724</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83723#p83723" />
			<content type="html"><![CDATA[<p>По какой например ссылке.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-06-07T10:02:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83723#p83723</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83713#p83713" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>sergeiplugatyr пишет:</cite><blockquote><div class="codebox"><pre><code>HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
MsgBox, % HTTP.ResponseText</code></pre></div></blockquote></div><p>Спасибо, помогло! Но появился новый вопрос, при получении русских букв, они становятся иероглифами, как это исправить?</p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-07T09:00:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83713#p83713</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83703#p83703" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;http://site.ru/file.txt&quot;)
HTTP.Send()
MsgBox, % HTTP.ResponseText</code></pre></div>]]></content>
			<author>
				<name><![CDATA[sergeiplugatyr]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30382</uri>
			</author>
			<updated>2014-06-06T18:48:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83703#p83703</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Получение данных со страницы сайта в переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83702#p83702" />
			<content type="html"><![CDATA[<p>Здраствуйте, снова прошу помощи. Скажите пожалуйста как через WinHTTP получить весь текст со страницы в интернете? Ссылка имеет примерно такой вид: <strong>site.ru/file.txt</strong>, открывается текстовый документ. Напишите пожалуйста исходный код. Заранее спасибо.</p>]]></content>
			<author>
				<name><![CDATA[tuma4ok]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32022</uri>
			</author>
			<updated>2014-06-06T17:04:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83702#p83702</id>
		</entry>
</feed>
