Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#205 2014-09-22 15:15:55
Re: smd_xml : extract data from XML feeds
Hi Bloke
Thanks for watching this, but the datawrap is not the problem (same result without it)!
Offline
#206 2014-09-22 15:29:17
Re: smd_xml : extract data from XML feeds
Dragondz wrote #284052:
the datawrap is not the problem (same result without it)!
Weird, worked for me on my test install. I copied and pasted your example, removed the datawrap
and debug
params, removed the spaces in the data
attribute and got back a nicely formatted record. Which version of the plugin do you have? 0.40 is the latest.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#207 2014-09-22 15:40:44
Re: smd_xml : extract data from XML feeds
Hi Block
Thanks a lot for your help it s probably the space in the url, i havent noticed it!!! my bad
it works now.
Thanks again for your help.
Offline
#208 2014-10-01 23:13:05
- johnno
- Member
- Registered: 2007-06-14
- Posts: 30
Re: smd_xml : extract data from XML feeds
Is there a way to set a user agent when making an API request using smd_xml?
Thanks
Offline
#209 2014-10-02 11:14:38
Re: smd_xml : extract data from XML feeds
johnno wrote #284419:
Is there a way to set a user agent when making an API request using smd_xml?
Sadly not at present, it’s hard-coded. I could allow you to do so if it would help?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#210 2014-10-02 16:45:24
- johnno
- Member
- Registered: 2007-06-14
- Posts: 30
Re: smd_xml : extract data from XML feeds
Thanks Stef.
Website I’m accessing has decided it needs a meaningful User-Agent to differentiate genuine requests from attacks.The examples quoted are along the lines of:
curl_setopt($ch, CURLOPT_USERAGENT, “bbpress-verify”);
Advice on how to hard-code this would help enormously!
Offline
#211 2014-10-02 21:01:02
Re: smd_xml : extract data from XML feeds
johnno wrote #284458:
Advice on how to hard-code this would help enormously!
Until I can get round to adding the option to the plugin, you can hack it in yourself. Edit the plugin code and find function smd_xml_curl
. In there you’ll see all the curl_setopt
calls. Add this somewhere among that list:
curl_setopt($c, CURLOPT_USERAGENT, “bbpress-verify”);
Job done.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#212 2014-10-03 16:52:12
- johnno
- Member
- Registered: 2007-06-14
- Posts: 30
Re: smd_xml : extract data from XML feeds
Job—as you rightly observe—done!
Thanks Stef.
Offline
#213 2015-05-05 09:50:12
Re: smd_xml : extract data from XML feeds
Hi Stef, would it be possible to add a user agent string to smd_xml accessing a feed? Some sites block access to their feeds without a user agent entry.
Thanx much in advance.
A hole turned upside down is a dome, when there’s also gravity.
Offline
#214 2015-05-05 10:32:57
Re: smd_xml : extract data from XML feeds
jayrope wrote #290465:
would it be possible to add a user agent string to smd_xml accessing a feed?
If you want to give the next version a go then that has this ability and could do with some beta testers. It’s not yet packaged into an installable plugin, but you can copy and paste just the code portion over your old version (or use ied_plugin_composer to install the full thing).
Configure it using the transport_config
, separating each entry with delim
(comma) and param_delim
(pipe) between key and data, e.g:
transport_config="useragent|Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0"
It defaults to Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0
.
Note that the config keys are not the same as the actual strings the browser sends (useragent
vs User-Agent
). This is so they can be whitelisted for now. Support is in there for a bunch of other keys to do with SSL / certificate verification for sites that support it, carriage-returns, ports, binary feeds and so on. The full list is in the plugin help.
Please let me know how successful (or otherwise) it is.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#215 2015-05-05 10:47:37
Re: smd_xml : extract data from XML feeds
Thanx Stef, will definately beta test this now. Awesome! You rock!
A hole turned upside down is a dome, when there’s also gravity.
Offline
#216 2015-10-07 15:31:57
Re: smd_xml : extract data from XML feeds
Hi Stef, I recently had a page crash with the following error and traced it back to a feed I was reading with smd_xml:
Fatal error: Maximum execution time of 30 seconds exceeded in /public_html/sitedomain/textpattern/lib/txplib_misc.php(812) : eval()’d code on line 137
The source was an old Yahoo Pipe feed that I’d forgotten about. Pipes is now gone (as of 9/30/15). I just tested smd_xml with an intentionally bad source and get the same error.
Just curious if there is any way to detect a bad source and let smd_xml fail without breaking the page with a fatal error?
Offline