Hi everybody, I need the help of the Unix community once again
I have some code which queries an XML feed and displays the results for me. I would like to enter the XML output in to my database, but I am having trouble passing the variables while INSERTing.
Here is my code that I need to alter:
PHP Code:
<?php
define('SORT', '/**searchterm**?format=georss');
define('QUERY_0', 'http://***********/search/si/');
function getSEARCH() {
$number = "1";
$word = urlencode($_POST['word']);
$alphaNUM = "$number/$word";
$url0 = QUERY_0.$alphaNUM.SORT;
$ch0 = curl_init();
curl_setopt($ch0, CURLOPT_URL, $url0);
curl_setopt($ch0, CURLOPT_HEADER, 0);
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch0, CURLOPT_FAILONERROR, TRUE);
$output = curl_exec($ch0);
curl_close($ch0);
$xml = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $output);
$xml = new SimplexmlElement($xml);
$word = urldecode($word);
echo "<h3>You searched for: $word</h3>";
foreach ($xml->channel->item as $data)
{echo '<div style="background-color:#ffff99;width:100%;padding:2px;border: 1px solid rgb(0, 0, 0); overflow: auto;">';
echo "<h3>";
echo $data->title . "<br />\n";
echo "</h3>";
echo $data->description . "<br />\n";
echo $data->georsspoint . "<br />\n";
echo "<p>\n";
echo '</div>';}}
getSEARCH();
?>
Any help would be greatly appreciated and thanks for taking the time to read this thread