Here’s my call:
[remote_content url="https://www.biblegateway.com/passage/?search=Psalm+18%3A7-19&version=NASB" method="POST" timeout="10. htmlentitie
s="false" strip_tags="false" decode_atts="false" selector=".version-NASB" remove=".passage-display-version,.dropdowns,.translation,.footnotes,.footnote,.crossrefs,.crossreference,.versenum,
.full-chap-link" cache="false"]
If you look at the source page and the target page, you see that there is a selector from the source page that is doubled in the target page:
class="version-NASB result-text-style-normal text-html"
It’s duplicated at a different level and results in doubled text. What’s odd is that I’ve been using this daily with different biblical passages each day and it’s worked brilliantly but today, no luck.
]]>Your plugin does exactly what I need it to do. Thank you.
Having some problems with an error (occasionally), though.
Using this in a WP page:
[remote_content url=”https://www.example.com/statement.html” timeout=”10″ htmlentities=”false” strip_tags=”false” selector=”pagecontent_right_inner” cache=”true” cache_ttl=”3600″]
What’s weird is it was working perfectly for awhile. Nothing changed on site.
After some time I get a server 500 error:
[Tue Jul 07 14:33:36.014282 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP Recoverable fatal error: Object of class __PHP_Incomplete_Class could not be converted to string in /var/www/www.example.com/wp-includes/shortcodes.php on line 343, referer: https://www.example.com/wp-admin/post.php?post=1111&action=edit
[Tue Jul 07 14:33:36.015773 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP Stack trace:, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015825 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 1. {main}() /var/www/www.example.com/index.php:0, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015852 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 2. require() /var/www/www.example.com/index.php:17, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015873 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 3. require_once() /var/www/www.example.com/wp-blog-header.php:19, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015894 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 4. include() /var/www/www.example.com/wp-includes/template-loader.php:106, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015917 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 5. get_template_part() /var/www/www.example.com/wp-content/themes/twentysixteen/page.php:24, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015938 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 6. locate_template() /var/www/www.example.com/wp-includes/general-template.php:168, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015959 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 7. load_template() /var/www/www.example.com/wp-includes/template.php:672, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.015989 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 8. require() /var/www/www.example.com/wp-includes/template.php:725, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016011 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 9. the_content() /var/www/www.example.com/wp-content/themes/twentysixteen/template-parts/content-page.php:20, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016031 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 10. apply_filters() /var/www/www.example.com/wp-includes/post-template.php:253, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016061 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 11. WP_Hook->apply_filters() /var/www/www.example.com/wp-includes/plugin.php:206, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016102 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 12. do_shortcode() /var/www/www.example.com/wp-includes/class-wp-hook.php:287, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016123 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 13. preg_replace_callback() /var/www/www.example.com/wp-includes/shortcodes.php:218, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
[Tue Jul 07 14:33:36.016143 2020] [php7:notice] [pid 4026] [client 1.2.3.4:60040] PHP 14. do_shortcode_tag() /var/www/www.example.com/wp-includes/shortcodes.php:218, referer: https://www.example.com/wp-admin/post.php?post=5633&action=edit
After some time the error goes away and now I see the remote content again (on both admin logins and no logins). Again – nothing saved/changed on site in meantime.
The only thing I can think of for this weirdness / on/off/on again error is caching on server side. But, I have made no further changes to site during any of this.
If the error stays away, great. But at least this was reported for others..
Anyone have any idea why it would do this? Server side caching like memcache?
Hi, I’ve been wrestling with a regex find/replace issue and I’m not having any success. I’ve tested my regex at: https://www.functions-online.com/preg_replace.html and https://www.phpliveregex.com/#tab-preg-replace and it works fine in both places.
Here is my shortcode:
[remote_content url="https://wolc.com/what-we-do/the-journey-for-adults/worship/christian-disciplines/prayer-for-the-week/" method="GET" timeout="10″ htmlentities="false" strip_tags="false" decode_atts="false" selector="#content" remove="#breadcrumbs" find="~<p><strong>Church\ Online\ Prayer\ Requests</strong></p>.*~sim" replace="</section>" cache="true" cache_ttl="3600″]
I get the section with the id “#content” just fine but the regex to get rid of the second half of the section is not working. I get the whole section back as if the regex was ignored.
Any thoughts of other places I could test to work this out? Thanks for this great plugin!
]]>Hello,
is there any method to make shortcode, that shows only content from another WordPress-page, example (class=”entry-content”)
Best regards,
Hoppendahl
Hello,
in classic use of your shortcode even with timeout settings,
remote content load is blocking my page load.
1) Is it possible to run this code simultaneously in the way that where home content is note blocked?
2) Is it possible that specific shortcode is runned in schedule, for example 1 time per week, and the loaded remote content is saved in txt file on my server?
Roman
]]>First of all, I’d like to thank you for this shortcode. This a life savior.
Unfortunately, I have a slight issue with it. While using it, accented characters do not show correctly.
We have a perl based system that does not add the encoding to the HEAD tag.
When using your shortcode, accented characters get displayed incorrectly.
Is there a way to work-around this?
]]>Is the Remote Content Shortcode plugin compatible with PHP 7.2?
I tried to use the PHP Compatibility Checker plugin from WPEngine but it’s not able to scan the plugin in the time allowed.
Sorry, the site is not publically available, but, the behavior I see is the page with the shortcode will render up until the shortcode is encountered. Without debugging turned on it’s just a blank spot in the page, with debugging it shows:
Fatal error: Uncaught Error: Class ‘DOMDocument’ not found in /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php:255
Stack trace:
#0 /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php(324): DOMDocumentWrapper->documentCreate(‘UTF-8’)
#1 /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php(244): DOMDocumentWrapper->loadMarkupHTML(‘<!DOCTYPE html>…’)
#2 /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php(191): DOMDocumentWrapper->loadMarkup(‘<!DOCTYPE html>…’)
#3 /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php(177): DOMDocumentWrapper->load(‘<!DOCTYPE html>…’, NULL, NULL)
#4 /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php(4857): DOMDocumentWrapper->__construct(‘<!DOCTYPE html>…’, NULL, NULL)
#5 /wp-content/p in /wp-content/plugins/remote-content-shortcode/inc/phpQuery.php on line 255
I would like to make a suggestion to support Page Character Encodings, being the default UTF-8.
On plugin attributes append:
'source_encoding' => 'UTF-8',
'target_encoding' => 'UTF-8',
Then when parsing the response
// strip the tags
...
// Convert the source encoding
if ( $source_encoding != $target_encoding ) {
$response = mb_convert_encoding($response, $target_encoding, $source_encoding);
}
// HTML encode the response
...
Too bad that we can’t make pull-requests like in GIT ??
What do you think about this feature ?
Hello,
I just saw that if we gave an HTTP URL to the shortcode and the target web server redirects on HTTPS, the shortcode won’t display anything…
I would suggest to add this line to your CURL request.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
Regards
]]>How many of the options for cURL requests does this plugin support? I don’t see a reference list anywhere. I’m new, so if this is obvious to other, I apologize. Are the only attributes you support the ones listed on the Details page?
I need to pass in a token with my cURL request, but I don’t know how to send this? I tried doing so using userpwd
but it didn’t work. Also, the syntax for how to use params
is very vague, I don’t quite understand what syntax to use. Could you please modify your example to show exactly how you would write a shortcode for params
? As a beginner who doesn’t know cURL, I can’t understand what you mean by params="key=value, foo, bar"
Hi
This plug had been working well but with an embedded Google Document I suddenly keep getting a foreign language (arabic?) used for the Google footer statement at the end of a document. Weird.
See bottom of page on link or see part screen capture at:
I have updated theme, all plugins and translations. No different.
Please adivse
]]>Hi,
even if I know a bit about php coding and developement, I am a wp beginner. I was reviewing the plugin code (current version 1.4.2), before installing, and trying to understand better the “meta” auth process (using meta_key/meta_value), which I was interested in, noted that the line 122 in remote-content-shortcode.php is:
if ( false!==( $meta_userpwd = get_post_meta( $userpwd, $post->ID, true ) ) ) {
but looking at the function reference (https://developer.www.ads-software.com/reference/functions/get_post_meta/) it seems the function is defined as
get_post_meta( int $post_id, string $key = ”, bool $single = false )
so, maybe the first parameter passed (mandatory) should be the post “id”, while above it seems to be passed as second, after the “password” we’re looking for in meta fields…
is this right? would this work?
Thanks, Marco
]]>any idea why the following might not work ?
find=”/<[Pp]>(?:.|\n)*?<[Hh][Rr]>/” or
find=”~<[Pp]>(?:.|\n)*?<[Hh][Rr]>~”
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
]]>When attempting to use selector=""
, and the remote content had multiple span
s with the same id
, the system returned PHP errors. I realize the actual problem lies in the remote content, but if we had a way to deal with it, it would be helpful.
I am trying to display content of a URL but But the error Could not resolve host: https://www.reverbnation.com (Could not contact DNS servers) displays. Please help.
]]>I’m scraping a site which used to work until they started redirecting to HTTPS. Can you please add support for HTTPS?
I also just want to add that when I try to send a request using HTTPS I get the following error message:
SSL connect error
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>Thanks for the module, works a treat!
However, using urls like “https://domain.com/site=1&lang=en” works only if you write this into the HTML part of the TinyMCE and save it there. When switching to the graphical editor, on save “&” will be replaced by “&” (plus “;” but this site strips it), and because of this the remote server doesn’t get the parameter (“lang=en” in the example above). Perhaps the plugin could replace them before passing to curl.
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>Hi,
How to get content on a new window only if user clicks the link? I want to add no follow to the link, too.
Please help.
I am using this code for now and it works:
[remote_content url="my remote url" method="GET" timeout="10" selector="div.availibility"]
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>I am trying to fetch a single JSON data value from a nginx server which redirects requests to an underlying z-way-server, both running on a Raspberry Pi. Might not be your typical usage scenario, but possibly the most basic content-wise.
When using the shortcode without the userpwd option I get an authentication error as expected. When adding this threw a site option I am left with the following response “SyntaxError: Unexpected token }”.
Any idea of what this could be about? Sounds like some parsing is going wrong but there really shouldn’t be much to parse – the response is just an integer. Any way to enable some more debug logging?
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>I have a site that is protected by a membership plugin (Wishlist Member). I am not able to get the content of that site. I have set the proper credetials on the shortcode, any idea on whats happening here?
Here is the shortcode:
[remote_content url=”https://socialmediatrainingfordirectselling.com/members/social-media-strategy-templates” method=”GET” timeout=”10″ userpwd=”username:password” htmlentities=”false” strip_tags=”false” decode_atts=”false” selector=”#post-4882″ remove=”img” cache=”true” cache_ttl=”3600″]
Note: For security reason, I removed the username and password.
Kindly help me with this conern, thank you!
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>I’m attempting to use the find=
and replace=
attributes in the shortcode in order to remove links from the text, but it doesn’t seem to work. I’ve tested my regex here and it doesn’t look like the regex is the problem.
Here is my code:
find="/<a\shref=\"(.*?)\">(.*?)<\/a>/igs"
replace="$2"
Do I have to use the tilde (~) delimiter? Can I not use modifiers?
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>Hi
Thank you for your plugin. I am not sure what i am doing wrong.
I am trying to scrape the contents of a table, however it just brings back
one column header called Ppen?
[remote_content url=”https://surreychampionship.play-cricket.com/league_table?id=1486&season_id=72″ selector=”.table”]
https://www.ads-software.com/plugins/remote-content-shortcode/
]]>