Jump to content
Fivewin Brasil

Baixar imagem da Internet


marcioe

Recommended Posts

Pessoal, bom dia 
Será que tem como baixar uma imagem da Internet, tipo assim 


https://www.google.com/search?q=7891114029734+JPG
 

ou Assim 
https://www.google.com/search?q=CHAVE+PHILLIPS+1/8X5+JPG

 

Dai fazer o Dowload,  ou algo do genero

 

Essa não funciona, a grande maioria dos produtos não localiza

http://www.eanpictures.com.br:9000/api/gtin/7896806700069

 

Esse acima não dá certo


 

Link to comment
Share on other sites

veja se essa função te ajuda

 

Static Function DownLoadFile(cFile,cDestino)
Local cEndereco := cFile
Local oHttp
Local cHtml
Local lRet := .F.
oHttp := TIpClientHttp():new( cEndereco )
oHttp:Open(cEndereco)
cHtml   := oHttp:readAll()
If ValType(cHtml) == "C" .and. Len(cHtml) > 0
   fErase(cDestino)
   MemoWrit(cDestino,cHtml)
   lRet := .t.
EndIf
 
Return lRet
Link to comment
Share on other sites

Olá amigo,s mas eu não sei exatamente onde a imagem esta, pois é uma pesquisa na net
Exemplo
 

ou seja eu não sei qual imagem a pessoa irá escolher

 

*-------------------------------------------------------------------------------
* Pesquisa a Foto Pelo Nome do produto
* 
* https://www.google.com/search?q=chave
*-------------------------------------------------------------------------------
function FOTO_GOOGLE(v_Nome_Produto,v_Codigo_Barras)
	If !IsInternet()
		MsgInfo('Problemas Com Acesso a Internet !',SISTEMA)
		return .f.
	ENDIF
	*----------------------------------------------------------------------------	
	* Se o Código de Barras For em Branco, 
	* Já Corta de Cara, e busca Pelo Nome
	*----------------------------------------------------------------------------	
	IF SUBSTR(v_Codigo_Barras,01,3) != '789'
		v_Codigo_Barras := ''
	ENDIF
	*----------------------------------------------------------------------------	
	IF !EMPTY(alltrim(v_Nome_Produto)+alltrim(v_Codigo_Barras))
		IF SUBSTR(v_Codigo_Barras,01,3) = '789'
			WebEXE3("https://www.google.com/search?q=" + ALLTRIM(v_Codigo_Barras) + ' JPG' )  //Busca Pelo Código de Barras
		ELSE
			WebEXE3("https://www.google.com/search?q=" + ALLTRIM(v_Nome_Produto) + ' JPG' )  //Busca Pelo Nome
	 	ENDIF
	ELSE
		MsgStop('O Campo Nome ou Código de Barras Não Poderá Ser Vazio !',M->SISTEMA)
	ENDIF
return

Hoje está assim,  dai ele abre o browse e pesquisa.

Link to comment
Share on other sites

*----------------------------------------------------
Function WebExe3(cLink) // visualiza e navega na pagina
*----------------------------------------------------
	default cLink:="http://www.google.com"
	clink:=GetEnv( "ComSpec" )+" /C START "+STRTRAN(cLink," ","+")
	WAITRUN(cLink, 0 )
RETURN

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...