Jump to content

knutsford

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

1 Neutral

About knutsford

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  1. knutsford

    $xml->xpath

    It is ok I have now managed it. I needed $nodes = $xml->xpath("//item//g:id[contains(text(),'$code')]/following-sibling::g:link"); $field = "g:link"; $url = ""; foreach($nodes as $node) { $url = (string)$node[0]; } It is ages since I have done anything with xml so I was rather rusty
  2. knutsford

    $xml->xpath

    <rss version="2.0"> <channel> <title>Big Game Hunters Online Store</title> <link>https://www.biggamehunters.co.uk/</link> <description>Products available from Big Game Hunters</description> <item> <g:id>88205</g:id> <g:title> Bee Ball Basketball Stand - BB-05 (1.6m to 2.1m) </g:title> <g:description> The BB-05 Stand by Bee Ball has a large rectangular backboard measuring 80cm x 58cm. This is similar to the shape to that of professional units and therefore offers better shooting practise than curved backboards. Depending on the age and height of your children you can adjust the ring between 1.6m and 2.1m. You can expect durability from the stand with a 16mm thick hoop which is 38cm wide. This is paired with an upgraded UV resistant net designed to last through all the seasons. Stability is also an important consideration and the large base when weighed down will ensure the stand stays upright during play. The wheels at the front of the base make it easy to move the stand should you need to play in a different spot in the garden. </g:description> <g:link> https://www.biggamehunters.co.uk/acatalog/BeeBall-Junior-Basketball-Stand.html </g:link> <g:image_link> https://www.biggamehunters.co.uk/acatalog/Bee-Ball BB-05(1).jpg </g:image_link> <g:condition>New</g:condition> <g:availability>in stock</g:availability> <g:price>59.99 GBP</g:price> <!-- <g:shipping> <g:country></g:country> <g:service></g:service> <g:price> </g:price> </g:shipping> <g:shipping_weight> kg</g:shipping_weight> --> <g:gtin>5035874881009</g:gtin> <g:brand>Bee Ball</g:brand> <!-- The following attributes are required for apparel and accessories, media and software; recommended otherwise --> <g:google_product_category> Sporting Goods > Athletics > Basketball > Basketball Hoops </g:google_product_category> <g:product_type>Basketball > Basketball Stands</g:product_type> </item> </channel> </rss> Is a full example with just one item
  3. knutsford

    $xml->xpath

    I am trying to do a search to get a url in PHP I have tried $the_id = $item['id']; $nodes = $xml->xpath("//item[contains(g:id,'$the_id')]"); foreach($nodes as $node) { $url = $node->g:link; } How do I do it? $url = $node->g:link; gives a syntax error Do I ignore g: and use id and link Thanks The xml layout is <item> <g:id>2023</g:id> <g:title> Croquet Set - Townsend </g:title> <g:description> Already a very popular set, the Townsend croquet set is now available in a more portable canvas carry bag. Perfect for people who wish enjoy croquet on the go. The Garden Games Townsend Croquet set has four beautifully crafted croquet mallets with attractive Rosewood mallet heads and solid Ash wood handles with leather bound grip for comfort, less vibration when hitting the solid 16oz composite regulation sized balls giving better accuracy. This high quality croquet set is easy to store in the strong and durable canvas carry bag. The set easily packs back into its storage bag ready for the next game. </g:description> <g:link> </g:link> <g:image_link> https://www.biggamehunters.co.uk/acatalog/Townsend-in-a-bag_1.jpg </g:image_link> <g:condition>New</g:condition> <g:availability>in stock</g:availability> <g:price>164.99 GBP</g:price> <!-- <g:shipping> <g:country></g:country> <g:service></g:service> <g:price> </g:price> </g:shipping> <g:shipping_weight> kg</g:shipping_weight> --> <g:gtin>5035874202309</g:gtin> <g:brand>Garden Games</g:brand> <!-- The following attributes are required for apparel and accessories, media and software; recommended otherwise --> <g:google_product_category>Sporting Goods > Outdoor Recreation > Lawn Games</g:google_product_category> <g:product_type>Croquet > Croquet Sets</g:product_type> </item>
  4. Thanks. I can do it with JavaScript without a problem. I just thought I would try required instead but I had no idea what to use for the pattern
  5. If you use <input required> how do you stop it from allowing just spaces and how do you make sure there is a minimum entry of 8 non spaces. Thanks
  6. knutsford

    laterooms

    Possibly slightly better but still slow. I think the main problem is laterooms sending back so much information that is is slowing it down at their end
  7. knutsford

    laterooms

    I am calling the xml file from laterooms using $xml = simplexml_load_file("http://xmlfeed.laterooms.com/index.aspx?aid=11929&rtype=4&kword=" . $County[0]); where $County[0] is the county name The I am using a loop to echo the contents of 5 of the child nodes foreach ($xml->hotel as $hotel){ } It is very slow so is there a quicker way of using the xml file? There are umpteen child nodes for each Hotel which I don't need which will be slowing it down to start with. Thanks
×
×
  • Create New...