Sign in to follow this  
Followers 0
goto11

inetgetsouce problem

10 posts in this topic

#1 ·  Posted (edited)

Hi

i want to download file ,inetgetsource ,http://image1.5read.com/image/ss2jpg.dll?did=b20&pid=533BC28982B0091DA50C5159B927E2B61819C676EA24FD1AA12DDDC996B52DC3118F55C6F11C576F3B23806B11C7

1742636473A96F015DB169DDD4E676AFF56AD4AE30012B7C74DA146794BE2BDD26EF7ECB5AAC62AB0B3A380B79B9B414C554

961C9D8B&jid=/000015.jpg and save to my computer c:

the problem is that the downloaded file is bad.When i downloaded the picture in another software, it was good

So,can you give some good advice

because i want to download with header ,therefore inetget and ie function are not good for me. softeware,such as,curl and wget also not suitable for me.

i hope using dll or winhttp to solve the problem

Thank you for your advice

Edited by goto11

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi

i want to download file ,inetgetsource ,"http://image1.5read.com/image/ss2jpg.dll?did=b20&pid=533BC28982B0091DA50C5159B927E2B61819C676EA24FD1AA12DDDC996B52DC3118F55C6F11C576F3B23806B11C7

1742636473A96F015DB169DDD4E676AFF56AD4AE30012B7C74DA146794BE2BDD26EF7ECB5AAC62AB0B3A380B79B9B414C554

961C9D8B&jid=/000015.jpg" and save to my computer c:\1.png

the problem is that the downloaded file is bad.When i downloaded the picture in another software, it was good

So,can you give some good advice

because i want to download with header ,therefore inget and ie function are not good for me. softeware,such as,curl and wget also not suitable for me.

i hope using dll or winhttp to solve the problem

thank you for suggestions

Edited by goto11

Share this post


Link to post
Share on other sites

to download a picture/or any file use InetGet

InetGetsource is used to get the HTML source code from the pages


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

to download a picture/or any file use InetGet

InetGetsource is used to get the HTML source code from the pages

there is no parameter "headr" in inet function ,however i will add special header on downloading, so it is not better for me Edited by goto11

Share this post


Link to post
Share on other sites

How about just using InetGet() :)


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

there is no parameter "headr" in inet function ,so i will use header, so it is not better

you say the file is bad. What do you mean?

I tried with & i can open the file & i see the picture & all is fine (its *.png)file btw, not *.jpg :

InetGet("http://image1.5read.com/image/ss2jpg.dll?did=b20&pid=533BC28982B0091DA50C5159B927E2B61819C676EA24FD1AA12DDDC996B52DC3118F55C6F11C576F3B23806B11C71742636473A96F015DB169DDD4E676AFF56AD4AE30012B7C74DA146794BE2BDD26EF7ECB5AAC62AB0B3A380B79B9B414C554961C9D8B&jid=/000015.jpg", "test.png", 1)
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

sorry,i did not want to use inetget .because it can not add another header.but it works well when downloading

there is problem occured when i use inetgetsourse ,then filewrite(cotent) to my computer

InetGet()

i want to add header to the downloading files.therefore inetget() is not good for me.

thank you

Edited by goto11

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

thank you for reply

CODE: AutoIt

$iecookie = "Accept: */*" & @CRLF & "Accept-Language: zh-cn" & @CRLF & "Accept-Encoding: gzip, deflate" & @CRLF & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"& @CRLF & "Connection: Keep-Alive"

$url = "http://image1.5read.com/image/ss2jpg.dll?did=b20&pid=533BC28982B0091DA50C5159B927E2B61819C676EA24FD1AA12DDDC996B52DC3118F55C6F11C576F3B23806B11C7

1742636473A96F015DB169DDD4E676AFF56AD4AE30012B7C74DA146794BE2BDD26EF7ECB5AAC62AB0B3A380B79B9B414C554

961C9D8B&jid=/000015.jpg"

$content = _InetGetsource("$url",$iecookie )

filewrite("test.png" ,$content )

the downloader pnd was bad

Edited by goto11

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

InetGet()

i want to add header to the downloading files.therefore inetget() is not good for me.

thank you

Func _newINetGetSource($s_URL, $s_Header = '')

If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL

Local Const $TMP_BUFFER_SIZE = 512

Local $h_DLL = DllOpen("wininet.dll")

Local $ai_IRF, $s_Buf = ''

e

Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0)

If @error Or $ai_IO[0] = 0 Then

DllClose($h_DLL)

SetError(1)

Return ""

EndIf

Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)

If @error Or $ai_IOU[0] = 0 Then

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])

DllClose($h_DLL)

SetError(1)

Return ""

EndIf

Local $v_Struct = DllStructCreate('udword')

DllStructSetData($v_Struct, 1, 512)

Local $BinaryBuffer = DllStructCreate("ubyte["&$TMP_BUFFER_SIZE&"]")

While DllStructGetData($v_Struct, 1) <> 0

$ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'ptr', DllStructGetPtr($BinaryBuffer,1), 'int', 512, 'ptr', DllStructGetPtr($v_Struct))

$s_Buf &= StringLeft(DllStructGetData($BinaryBuffer,1), DllStructGetData($v_Struct, 1))

wend

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])

DllClose($h_DLL)

Return $s_Buf

EndFunc

$iecookie = "Accept: */*" & @CRLF & "Accept-Language: zh-cn" & @CRLF & "Accept-Encoding: gzip, deflate" & @CRLF & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"& @CRLF & "Connection: Keep-Alive"

$url = "http://image1.5read.com/image/ss2jpg.dll?did=b20&pid=533BC28982B0091DA50C5159B927E2B61819C676EA24FD1AA12DDDC996B52DC3118F55C6F11C576F3B23806B11C7

1742636473A96F015DB169DDD4E676AFF56AD4AE30012B7C74DA146794BE2BDD26EF7ECB5AAC62AB0B3A380B79B9B414C554

961C9D8B&jid=/000015.jpg"

filewrite("test.png",_newINetGetSource($url,$iecookie))

it is my code.

the picture was downloaded and the size is same to picture downloaded by inetget

however the png downloaded by inet can be read ,the one downloaded by newinetgetsource can not be read

can anyone give me some help on my code,which one is wrong

thank you

i want to use winapi_writefile in place of function filewrite,but failed.,also want help

sorry, do not post until someone helps

Edited by goto11

Share this post


Link to post
Share on other sites

You've made 4 posts in a row, in less than 2 hours.

This is not appropriate behavior (Constant bumping, it's considered rude to those that obey the forum rules and etiquette) regardless of new information you want and or do not understand.

Do not post again in this thread until someone else replies to you ... They will help if they know how and or if they want to.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0