Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Feed help 1

Status
Not open for further replies.

MC44

Programmer
Jul 26, 2008
1
ES
Hi, I have a real estate portal where I use an xml feed to import an agents properties onto my database. At the moment I leave the photo on their server
<image1>yet now I need to copy their images onto my server. How would I do this? Thanks can you give me the exact code I would need please
 
You can run a short (vb/js or else) script on the server. The url can be read from the feed. But herein-below taken as a given. You have to determine how to name the saved image as well as a given. You have to use your own preference script language. Here is how in vbs.
[tt]
'script language: vbs

'as input to the script
[blue]surl="[ignore][/ignore]"
slocal="d:\images\1494-2.jpg"[/blue]

on error resume next
set oxmlhttp=createobject("msxml2.xmlhttp")
if err.number<>0 then
wscript.echo "msxml2.xmlhttp not installed. Operation aborted."
set oxmlhttp=nothing : wscript.quit 1 'or exit sub
end if
with oxmlhttp
.open "get",surl,false
.send
end with
if err.number<>0 then
wscript.echo "Resource unavailable for varied reasons. Operation aborted."
set oxmlhttp=nothing : wscript.quit 2 'or exit sub
end if

set ostream = createobject("adodb.stream")
with ostream
.type=1 'binary
.mode=3 'read-write
.open
.write oxmlhttp.responsebody
.savetofile slocal,2 'save-create-overwrite
.close
end with
if err.number<>0 then
wscript.echo "You need ado2.5 up. Operation aborted"
else
wscript.echo "Done!" & vbcrlf & "Source : " & surl & vbcrlf & "Local : " & slocal
end if
on error goto 0
set ostream=nothing : set oxmlhttp=nothing
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top