• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: curl equivalence
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curl equivalence


  • Subject: Re: curl equivalence
  • From: "John R." <email@hidden>
  • Date: Wed, 26 Oct 2005 00:16:11 -0400

Thanks for the response - comments below

on Wed, 26 Oct 2005 00:48:25 kai wrote
> Doesn't this do about the same thing, John?
> to getHTML from myURL
>      tell application "Safari" to tell document 1
>          set URL to myURL
>          repeat 40 times
>              if URL is myURL then return source
>              delay 0.5
>          end repeat
>      end tell
>      error "Oops - problem accessing internet..."
> end GetHTML
>
> getHTML from "http://www.apple.com/";

I thought so too at an early, naive stage in my journey, but...
(1) Websites often redirect to different URLs, and the resulting URL can include unknowns like, say, a session ID#.
(2) If you poll the Safari's URL property too soon, it never starts at all!



on Tue, 25 Oct 2005 20:06:39  Daniel Jalkut wrote:
> I'm pretty confident you can get curl to work. You have to
> essentially use curl to build up a "cookie file" that is specific to
> the site, and always direct curl to use that cookie file as a "send/
> receive" stash for that site.
Yup, thats what the manual says. In order to emulate my real browser in curl, I need to give the correct parameters for authentication, for cookie format, for user-agent, for forms data submission, etc. I never could get all these functions to work right and I spent a lot of time reverse engineering. My biggest frustration was not getting good feedback from curl or the site about what I was doing wrong. Maybe there are some curl or Unix secrets I do not know?

> But you are sending a mixed message here. Curl would be wonderful,
> but Safari is better because you can see it.  Which would you prefer? :)
Let me be clear: curl would be wonderful automation because I call with confidence and simply wait for text returned.  I was motivated enough to learn perl basics and play with LWP::Mechanize. It has a CPAN module claiming to allow use of Safari's own cookie file, eliminating that headache. I am sure they do work somehow, but I ran into the same problem: all those picky parameters. I found visualizing how the sites react to my strange requests helps with debugging. But let me be clear again: I don't want to debug - I want to get the HTML!

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: curl equivalence
      • From: kai <email@hidden>
  • Prev by Date: Re: Do Shell Script
  • Next by Date: Re: curl...file listings...
  • Previous by thread: Re: curl equivalence
  • Next by thread: Re: curl equivalence
  • Index(es):
    • Date
    • Thread