Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#196 2013-03-19 11:55:38
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: smd_xml : extract data from XML feeds
That’s it!
Thank you and also thank you for the moments of happiness, thanks to this solution! (I had spent the whole of Sunday with experiments for a solution and was completely frustrated at the end.)
Offline
#197 2013-03-19 12:01:13
Re: smd_xml : extract data from XML feeds
GugUser wrote:
Thank you and also thank you for the moments of happiness, thanks to this solution! (I had spent the whole of Sunday with experiments for a solution and was completely frustrated at the end.)
Glad it worked. Sorry I didn’t reply sooner but there was a client crisis over the weekend that I was mopping up and I didn’t get to the forum much.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#198 2013-03-19 12:16:27
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: smd_xml : extract data from XML feeds
You have nothing to apologize. Your idea with the use of variables I had not previously considered, but was essential. Now it works and I have one problem less.
Offline
#199 2014-01-12 20:57:00
Re: smd_xml : extract data from XML feeds
How can i apply this for instagram?
Thanks
Offline
#200 2014-01-13 20:31:19
Re: smd_xml : extract data from XML feeds
kuro wrote #278093:
How can i apply this for instagram?
Depends what you’re trying to do! Give me a clue with an example feed and I’ll see if the plugin can help.
For info, the way the plugin works is a little bit out-dated now (SimpleXML is a better engine, imo) so I was on the cusp of rewriting it but then etc_query came along and is arguably a much better engine entirely if you speak XSLT. So development of the next version of smd_xml is pending.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#201 2014-01-18 22:59:05
- PeteSwed
- New Member
- Registered: 2014-01-18
- Posts: 1
Re: smd_xml : extract data from XML feeds
Getting stuck with this one. Can´t get any data out off this.What am i doing wrong? Can someone help me?
<txp:smd_xml data="https://svenskaspel.se/xternal/XMLresultat.asp?produktid=1" record="utdelning" fields="vinstgrupp,beteckning,antal,vinst">
<p>{vinstgrupp} {beteckning} - {antal} {vinst}</p>
</txp:smd_xml>
Offline
#202 2014-01-19 18:56:56
Re: smd_xml : extract data from XML feeds
Hi,
vinstgrupp is not an atomic value, shouldn’t your query be
<txp:smd_xml data="https://svenskaspel.se/xternal/XMLresultat.asp?produktid=1" record="vinstgrupp" fields="beteckning,antal,vinst">
<p>{beteckning} - {antal} {vinst}</p>
</txp:smd_xml>
Offline
#203 2014-09-22 13:55:17
Re: smd_xml : extract data from XML feeds
I dont know what i am missing here:
<txp:smd_xml data=" http://www.islamicfinder.org/prayer_service.php?country=algeria&city=algiers&state=01&zipcode=&latitude=36.7631&longitude=3.0506&timezone=1.00&HanfiShafi=1&pmethod=2&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml" record="prayer" fields="fajr, dhuhr, asr, maghrib, isha, date, city" set_empty="1" datawrap="my_records" debug="3">
<p>{fajr}<br/>{asr}<br/>{smd_xml_totalrecs}</p>
</txp:smd_xml>
the xml feed work:
<?xml version="1.0"?>
<prayer>
<fajr>5:02</fajr>
<sunrise>6:35</sunrise>
<dhuhr>12:41</dhuhr>
<asr>4:08</asr>
<maghrib>6:46</maghrib>
<isha>8:09</isha>
<date>September 22, 2014</date>
<hijri>27 Dhul-Qadah 1435</hijri>
<city>Algiers</city>
<country>Algeria</country>
<website>www.IslamicFinder.org</website>
</prayer>
the debug mode gave me this:
<txp:smd_xml data=" http://www.islamicfinder.org/prayer_service.php?country=algeria&city=algiers&state=01&zipcode=&latitude=36.7631&longitude=3.0506&timezone=1.00&HanfiShafi=1&pmethod=2&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml" record="prayer" fields="fajr, dhuhr, asr, maghrib, isha, date, city" set_empty="1" datawrap="my_records" debug="3">
[smd_xml reading cache smd_xml_data_8b91cf]
[smd_xml conversions: Array
(
)
]
[smd_xml filtered source: <my_records> http://www.islamicfinder.org/prayer_service.php?country=algeria&city=algiers&state=01&zipcode=&latitude=36.7631&longitude=3.0506&timezone=1.00&HanfiShafi=1&pmethod=2&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml</my_records>]
[smd_xml start watchers: Array
(
)
]
[smd_xml end watchers: Array
(
)
]
[smd_xml watch forms: Array
(
)
]
[smd_xml paging info: Array
(
[numrecs] => 0
[page_rowcnt] => 0
[limit] => 0
[offset] => 0
[pgoffset] => 0
[running_rowcnt] => 0
[first_rec] => 1
[last_rec] => 0
)
]
[smd_xml fields: Array
(
[0] => fajr
[1] => dhuhr
[2] => asr
[3] => maghrib
[4] => isha
[5] => date
[6] => city
)
]
[smd_xml subfields: Array
(
[0] => fajr
[1] => dhuhr
[2] => asr
[3] => maghrib
[4] => isha
[5] => date
[6] => city
)
]
[smd_xml indexed subfields: Array
(
[fajr] => Array
(
)
[dhuhr] => Array
(
)
[asr] => Array
(
)
[maghrib] => Array
(
)
[isha] => Array
(
)
[date] => Array
(
)
[city] => Array
(
)
)
]
[smd_xml tree fields: Array
(
[fajr] => Array
(
)
[dhuhr] => Array
(
)
[asr] => Array
(
)
[maghrib] => Array
(
)
[isha] => Array
(
)
[date] => Array
(
)
[city] => Array
(
)
)
]
</txp:smd_xml>
The result is empty!
Offline
#204 2014-09-22 14:25:53
Re: smd_xml : extract data from XML feeds
Dragondz wrote #284049:
I dont know what i am missing here:
You don’t need the datawrap attribute because the data is already wrapped in <prayer> tags.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#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.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#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.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#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