Modernvox Posted January 9, 2010 Share Posted January 9, 2010 $CL = "Craigslist"; I have my code all complete with one exception. After I select a State from the drop down box the script scrapes the appropriate data from CL and displays it on the page. That's Great, right? Right! But it also transforms all my buttons and images into a link which is the same link from the last results returned from the original request? If you go to http://dezi9er.net16.net/search.php and just press submit the first attempt will return the results the way it is suppose to, But Now it turns everything into a link? click on the bouncer image or any of the buttons and it will take you to a CL listing. This is crazy! What is going on here? Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/ Share on other sites More sharing options...
oni-kun Posted January 9, 2010 Share Posted January 9, 2010 But it also transforms all my buttons and images into a link which is the same link from the last results returned from the original request? Umm, If you're scraping links they'd become links after displaying them? What is your code? You're doing nothing but displaying a website to us without any relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/#findComment-991545 Share on other sites More sharing options...
joel24 Posted January 9, 2010 Share Posted January 9, 2010 its making all the navigation etc link to the last search result... are you closing the anchor tag correctly (</a>)? or is this last link overriding a variable which is storing the links for the navigation etc..? you'll have to post your code. Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/#findComment-991546 Share on other sites More sharing options...
Modernvox Posted January 9, 2010 Author Share Posted January 9, 2010 My Bad <?php $st = isset($_POST['submit']) ? $_POST['state'] : ''; $urls = array(); if ($st == "AL") { $urls = array("http://auburn.craigslist.org", "http://bham.craigslist.org"); } else if ($st == "AK") { $urls= array("http://anchorage.craigslist.org"); } foreach ($urls as $url) { $html = file_get_contents("$url/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); $i = 1; //set start point; $limit = 60; //set limit; foreach ($posts as $post) { //print $post[0]; //HTML $post[2] = str_ireplace($url,"",$post[2]); //remove domain echo "<a href=\"$url{$post[1]}\">{$post[2]}<font size=\"3\">{$post[3]}<br />"; print "<BR />\n"; if ($i == $limit) { break; } $i++; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/#findComment-991554 Share on other sites More sharing options...
trq Posted January 9, 2010 Share Posted January 9, 2010 You never close your anchor tags (or your font tags for that matter). echo "<a href=\"$url{$post[1]}\">{$post[2]}<font size=\"3\">{$post[3]}</font></a><br />"; Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/#findComment-991556 Share on other sites More sharing options...
Modernvox Posted January 9, 2010 Author Share Posted January 9, 2010 Thanks Joel(You were on the right track) and of course my good man Thorpe who has helped me on many a occasions. Much appreciated...believe me Quote Link to comment https://forums.phpfreaks.com/topic/187796-calling-all-freaks-php-freaks-that-is/#findComment-991569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.