Re: Advice required with cURL, please!


Brian Christmas
 

Steve, thanks for trying, but your code, and my slightly amended code, both return…

Can’t set end of "<!DOCTYPE html>
<html style=\"height:100%\">
<head><title> 404 Not Found
</title></head>
<body style=\"color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;\">
<div style=\"height:auto; min-height:100%; \">     <div style=\"text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;\">
        <h1 style=\"margin:0; font-size:150px; line-height:150px; font-weight:bold;\">404</h1>
<h2 style=\"margin-top:20px;font-size: 30px;\">Not Found
</h2>
<p>The resource requested could not be found on this server!</p>
</div></div></body></html>" to {{"ozsanta@..."}, {"meSelfSoftWare.com"}}.

What I want is the CONTENT of the file, not its properties, please?

AND, is my saving line correct?

I’m completely guessing, and Shane’s told me ‘DON’T GUESS!’, BUT I CAN’T WORK THE TERMINOLOGY OUT!.

What I THINK I’m doing wrong is addressing the .txt file in the wrong way. <p>The resource requested could not be found on this server!</p> I have no idea what I’m supposed to do, and have read the cURL help and examples over and over. I just cannot wrap my mind around what I’m doing wrong!

Regards

Santa

property EmailAddress : "ozsanta@..."
property businessName : "meSelfSoftWare.com"
property theEmailList : {}


set theCheckPath to "http://meselfsoftware.com/xxxxx%20list/xxxx%20Email.txt/“ # Modified for posting

set (my theEmailList) to {}
try
say 0
set (my theEmailList) to do shell script "curl file_get_contents " & theCheckPath
set (my theEmailList) to do shell script "curl  " & theCheckPath # Steve’s script
# do shell script "curl  file_get_contents " & theCheckPath & " echo " & (my theEmailList)
on error
say 0.1
set (my theEmailList) to {}
end try
if (count of (my theEmailList)) = 0 then set (my theEmailList) to {}
say 1
try
set end of theEmailList to {{EmailAddress}, {businessName}}
on error errmsg
set end of theEmailList to {{EmailAddress}, {businessName}}
tell application "System Events" to display dialog errmsg
end try
say 2
try
do shell script "curl -T -d " & (my theEmailList) & " --url " & theCheckPath
on error errmsg
tell application "System Events" to display dialog errmsg
end try


theEmailList

I’m deriving the path from this… which is in the same site folder

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
</dict>
</plist>

The Site Inspector say their folder is /home/meselfso






On 23 Oct 2017, at 1:50 pm, Steve Mills <sjmills@...> wrote:

On Oct 22, 2017, at 20:53:06, Brian Christmas <ozsanta@...> wrote:

G’day scripters

I want to read a remote .txt file using cURL, and save the result to a variable, NOT a file.

set x to do shell script "curl " & theURL

--
Steve Mills
Drummer, Mac geek

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (applescript-users@...)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/ozsanta%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users

This email sent to ozsanta@...

Join applescript@apple-dev.groups.io to automatically receive all group messages.