Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Running JavaScript from within Perl

by marto (Archbishop)
on Sep 15, 2019 at 18:32 UTC ( #11106202=note: print w/replies, xml ) Need Help??


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

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.

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

Replies are listed 'Best First'.
Re^6: Running JavaScript from within Perl
by anautismobserver (Acolyte) on Sep 15, 2019 at 18:48 UTC

    When I tried to follow the official WordPress documentation I got stuck on the authorization requirement (how to get "YOUR_API_TOKEN"). The instructions confused me. I was hoping the book could walk me through that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2019-10-17 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?