Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Running JavaScript from within Perl

by anautismobserver (Sexton)
on Sep 15, 2019 at 08:31 UTC ( [id://11106191]=note: print w/replies, xml ) Need Help??


in reply to Re: Running JavaScript from within Perl
in thread Running JavaScript from within Perl

I don't mind responses that go beyond the narrow bounds of what I asked. It's like learning a new language: sometimes it's best to immerse myself in the new culture and see what I can absorb.

I like learning new software through following tutorials (though this runs the risk of learning outdated information). I'm starting working through The Ultimate Guide To The WordPress REST API (written in September 2015 by Josh Pollock). He recommends using Vagrant, VirtualBox, and Git, which I've downloaded and installed on my computer

Is The Ultimate Guide To The WordPress REST API a good resource (obtained from here)?

Do you know of any better (perhaps newer) tutorials for the WordPress REST API?

  • Comment on Re^2: Running JavaScript from within Perl

Replies are listed 'Best First'.
Re^3: Running JavaScript from within Perl
by marto (Cardinal) on Sep 15, 2019 at 09:26 UTC

    "I don't mind responses that go beyond the narrow bounds of what I asked. It's like learning a new language: sometimes it's best to immerse myself in the new culture and see what I can absorb."

    The method described in the post you're replying to wont help you achieve what you asked to do. If you're interested in learning about JavaScript and HTML/DOM manipulation there are better resources (from the Mojolicious docs):

    "All web development starts with HTML, CSS and JavaScript, to learn the basics we recommend the Mozilla Developer Network. And if you want to know more about how browsers and web servers actually communicate, there's also a very nice introduction to HTTP."

    "I've downloaded and installed Vagrant, VirtualBox, and Git for Windows on my computer"

    What part of problem does this solve?

    "Is this a good resource? (https://wpengine.com/resources/the-ultimate-guide-to-the-wordpress-rest-api/)"

    I've no idea, you need to register to download an ebook.

    "Do you know of any better (perhaps newer) tutorials for the WordPress REST API?"

    What is missing from the official WordPress documentation?

    Update: Re^3: Running JavaScript from within Perl (or just use the API)/https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/stats/followers/.

      Here's a link to the book: http://cdn2.hubspot.net/hubfs/298401/Documents_for_download/WP-API-ebook_final_09162015.pdf

      It offers a step-by-step guide to using the WordPress REST API. It recommends using VVV (Vagrant), and somewhere in the instructions were also recommendations for VirtualBox and Git.

      What's missing from the official WordPress documentation is a step-by-step guide to using the WordPress REST API for neophytes like me.

        Thanks for the links and the context. At a really quick glimpse the ebook suggests that you host your own WordPress sites locally for testing purposes. From what I've read so far you have an existing WordPress site and are looking to programmatically query some of the associated data from time to time, using it to do something or other. If this is the case, unless you want to work through this whole book, hosting sites locally for test purposes I suggest this is overkill.

        Without knowing how much you know I'll mention a few things. The WordPress docs I linked to explain how their REST interface should be used. If you have curl installed you can run their example code for followers (if you have provided authentication details matching their site, rather than the example they provide), and see the response it gives you.

        You could scrape this via WWW::Mechanize::Chrome, however it's always better to use an API if one exists, less subject to change, fewer prerequisites, often more portable. So depending on exactly what you want to achieve perl offers lots of ways to solve the problem, including REST::Client, HTTP::Request::FromCurl (this live demo lets you convert a curl request to perl code) and so on.

        Take a look, do some reading (Super Search is your friend), let us know if you have specific questions.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11106191]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 01:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found