Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dowloading Internet Files
Message
From
08/05/2018 06:21:31
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
08/05/2018 05:39:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012
Database:
Firebird
Application:
Desktop
Virtual environment:
VMWare
Miscellaneous
Thread ID:
01659775
Message ID:
01659824
Views:
40
>>I need to automate the downloading of files identified in web hyperlinks contained in the body of incoming email messages. No problem using Outlook automation to open the messages and parsing them to extract the links. And calling the Windows API function URLDownlLoadToFile then usually works fine. But problems arise with one company whose messages containing links formatted as http://www.companyname.com/Admin/FormCenter/Submissions/ViewFile/446/?name=PhotoFile.jpg. In those cases URLDownlLoadToFile returns html page code that again contains that link, rather the actual photo file sought. Manually clicking such links from a web browser does present an option to either save or open the needed file, so might the solution involve automating Internet Explorer, or using the WebBrowser control? Or is there an easier way?
>
>It could be checking for a cookie or somehow reposted username/password, which is available in the browser but not in your API call. Tried a similar thing myself once (trying to automate the statcounter checking for my website) and that's where I gave up. Looking for a way to send the missing part without knowing what exactly the browser sends (and how) was taking longer than I expected and I lost interest. But you may look at the console (like FireBug's or whatever tool your browser has by itself) to see what exactly is your browser sending, and try to do the same when making that API call. Please report here if you succeed.

Code is often more readable if using XmlHTTP, speed differences of API vs COM call should be irrelevant if web hops are in the loop ;-)
Previous
Reply
Map
View

Click here to load this message in the networking platform