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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL to PDF

Status
Not open for further replies.

DChalom

Programmer
Jun 8, 2002
59
US
How would I go about saving a PDF that a URL points to to a PDF File?
I am looking for a funtion that I send it the URL of a PDF file and the file name I want ity saved to. i.e.,
pURL2PDF(pURL, pPDF)

 
What happened when you tried it?

What code did you use to call it?
 
I did not get my PDF file
I called like this:

Do ReadUrl2 WITH "<url>",,,"C:\Test.PDF"

However as I look at this I do not know if I had two or three commas there.

I want to thank you all for the help. Who would of thaught I would of recieveed so much help with this issue.


Dorian C. Chalom
 
It did work....now all I have to do is figure the simplist way to work it in to the who equation....if you so wish the whole problem is below.

eMail comes into this certain account

Read the last name of the person, which is in the body of the eMail

The eMail may have links in it.
Open the links
Save the documents to a folder
the folder name made up of the last name and a
case number the case number is on the subject
line

Depending on the first letter of the last name create an email to go to a certain person.
With the last name and case number in the subject
line
Attaching the documents that you down loaded



Dorian C. Chalom
 
For retrieving email, see:
VFP is great at text parsing to find the links in the email

To send the response emails, see:
And you have the ReadUrl code for HTTP GET. Many ActiveX tools (from Microsoft, even) include HTTP GET functionality, like the WinInet.dll used in ReadUrl, and the MSXML component)

( A comparison of the different ways to send emails from within VFP: )
 
How would I go about stripping all the HTML code from the emails? I think it is HTML....except i do need to know some of them to get to the linked PDF files.


Dorian C. Chalom
 
In the example code on the GetPopEmail page ( ) this code is shown:
Code:
  IF OX.NUMBEROFEMAILS>0
   ? 'First Email:'
   FOR LNI = 1 TO OX.NUMBEROFEMAILS
    ? OX.RETRIEVE(LNI)
    LCEMAIL = OX.MSGCONTENTS
    STRTOFILE('----Email#'+TRAN(LNI)+'--------'+CRLF ;
     +LCEMAIL+CRLF,'c:\data\email\Email.txt',.T.)
   ENDFOR

the line LCEMAIL = OX.MSGCONTENTS
retrieves the contents of a specific email. The next line simply writes that text to a file at C:\data\email\email.txt, but you can do whatever you want with it, like parsing it to find the URLs, etc.

How to parse text is a completely different problem than how to send/retrieve email or HTTP GET files. You can use ATC(), SUBSTR(), LEFT(), and functions like that to do the parsing... to give more specific advice you need to post the text you're trying to parse.
 
I tried GetPopEMail and I got a
"Class Definition MSWINSOCK.WINSOCK is not found"
Program Error

Dorian C. Chalom
 
It's using the MSWINSCK.OCX microsoft activeX control. It ships with VFP, but mustn't automatically be registered. Find that file, and execute the Shell command:
REGSVR32 MSWINSCK.OCX

to register it. You can download the OCX here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top