Jump to content

hhackwell

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by hhackwell

  1. Hi everyone! This has been causing me massive stress over the past 48 hours, I simply don't know enough about PHP to resolve this problem (which is probably quite simple!), so I thought I'd turn to the experts I have an XML string that I have successfully managed to import and I want to extract one specific element/node from this string, which happens to be a URL. This is the XML string (I removed some of the unrelated elements to make it easier to read): <?xml version="1.0" encoding="utf-8"?> <elements> <facebookilike identifier="78a0daa1-8b7e-4793-9f19-65991d485a3c"> <value><![CDATA[1]]></value> </facebookilike> <text identifier="c5bba97d-1158-4359-9089-9f35b243a60f"> <value/> </text> <text identifier="70e50e8d-2a2d-4ca4-9f4e-0f691aaf7a96"> <value><![CDATA[Olivia Palermo]]></value> </text> <text identifier="b4ba2eaf-ae3c-4e31-81fa-979cfd9fe811"> <value><![CDATA[£590]]></value> </text> <link identifier="d6539bee-d12b-4a66-b8a1-fd0a7c42cda7"> <value><![CDATA[http://www.theitguide.com]]></value> <text/> <target/> <custom_title/> <rel/> </link> <textarea identifier="beab45eb-b32a-4766-822d-b3fb72b5b1d4"> <value><![CDATA[<p>Red satin pumps with ruffle fan back and a heel that measures approximately 150mm/ 6 inches with a 40mm/ 1.5 inch island platform. Charlotte Olympia pumps have an almond toe, satin covered platform and heel, gold metal designer logo at sole, leather inner sole and comes with matching colored stockings with spider web insignia at calf.</p>]]></value> </textarea> <socialbookmarks identifier="00e1df62-828d-42f5-a1a6-a89d553d4934"> <value><![CDATA[1]]></value> </socialbookmarks> <relateditems identifier="64c188a6-cf2f-4895-8879-8b67a58b6780"/> </elements> I want to extract the link 'http://www.theitguide.com' - and only this. I've built a redirection page to get this XML from my database, which looks like this: <?php $item_id = $_GET['pid']; if (is_numeric($item_id)) { $fullURL; $con = mysql_connect(xxxxx, xxxxxx, xxxxxx); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxx", $con); $result = mysql_query("SELECT * FROM jos_zoo_item WHERE id='".$item_id."'"); while($row = mysql_fetch_array($result)) { $xml = $row["elements"]; } --MISSING CODE-- echo $URL; if (strlen($URL) > 0) { $fullURL = $URL; } else { $fullURL = $mosConfig_live_site; } } else { $fullURL = $mosConfig_live_site; } ?> <html> <head> <script type="text/javascript"> <!-- window.location = "<?php echo $fullURL; ?>" //--> </script> The code I believe I'm missing is to take $xml, extract my URL from it and then create $URL with that URL as the content. Could someone help me out and put me out of my misery Thank you!!! Helen
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.