Hello,
This code keeps tripping the error notifier. I've validated it. The $url is valid as I see the output xml if I go to the "real address." Any thoughts on this would be appreciated.
Here is the input from the search formCode:<?php if (!isset($_GET['qry'])) { echo '<ul class="listings-results search">'; echo "<li><h4>We’re sorry, search is currently undergoing maintenance.</h4></li></ul>"; } $qry = urlencode($_GET['qry']); $url = "http://myserver.com/SearchServlet?cname=newyork&fe=utf-8&st=adv&q_phr=&q_low=&q_not=&oc=all&pagesize=100&q_all={$qry}"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xml_string = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($xml_string); echo '<pre>'; //echo var_dump($xml->results); exit; if ($xml->results>0){ echo '<ul class="listings-results search">'; } foreach($xml->results->result as $the) { echo '<li class="listing-results">'.'<a href="'.$the->url.'">'.'<h4>'.fix_curlys($the->title).'</h4>'; echo '<span class="desc">'.fix_curlys($the->description).'</span>'.'</a>'.'</ul>'; } echo '</pre>'; function fix_curlys($text){ return str_replace( array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '"', '"', '-', '--', '...'), $text); // Next, replace their Windows-1252 equivalents. $text = str_replace( array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $text); } ?>
Thanks in Advance.Code:<form action="/results2.php" accept-charset="UTF-8" method="post" id="search-form"> <input type="text" id="search-field" maxlength="128" value="Search!" title="Enter the terms you wish to search for." onfocus="if (this.value==this.defaultValue) this.value='';" onblur="if (this.value=='') this.value=this.defaultValue;" name="qry" class="form-text"/>ev <button class="form-submit"/> </form>



Reply With Quote

Bookmarks