Jump to content

Help!php

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Help!php's Achievements

Member

Member (2/5)

0

Reputation

  1. There is a reset button on my page and it works fine but now I want to let the user reset the information and redirect the page to homepage. So far this is how the code looks. its in javascript. function formReset() { var fields = document.getElementsByTagName( "input" ); for ( i = 0; i < fields.length; i++ ) { if ( fields[ i ].type == "checkbox" ) fields[ i ].checked = false; } document.getElementById( 'rrpmin' ).selectedIndex = 0; document.getElementById( 'rrpmax' ).selectedIndex = 0; eraseCookie( _cookieName ); fieldClick(); }
  2. Just aspx page. The code you provided me work. . I did try to use simple_html_dom.. didnt really work. So I thank you for the help and if you were here would have got a big fat hug(I am a girl) .. you saved me.. So thank you..
  3. Sorry.. Well I am trying to read a sitemap and get the URL and the page is not displaying. But I managed to change one of the name to true and its printing what I echoed but no result. $_ECHO = TRUE; This was false before. Now that I have changed it to true.. It prints START: Fetching site map.. then it goes straight to NO URL FOUND ON THIS PAGE. its skipping the middle bits. any help??? $numSitemapPages = 1; $html = new simple_html_dom(); if($_ECHO) echo "START: Fetching site map...<br />"; for( $i = 0; $i < $numSitemapPages; $i++ ) { if($_ECHO) echo "Page $i<br />"; $fileContents = file_get_contents( "http://www.website.co.uk/SiteMap" . $i . ".aspx" ); $html->load( $fileContents ); $hrefs = $html->find( "a(style=color: Blue; text-decoration: underline;)" ); if ( isset( $hrefs[ 0 ] ) ) { foreach( $hrefs as $href ) { $url = "http://www.website.co.uk/" . $href->href; $qry = "INSERT INTO SITEMAP (url) VALUES( '$url' )"; mysql_query( $qry, $con ); if($_ECHO) echo "MYSQL: Added $href->href to DB<br />"; } } else if($_ECHO) echo "NO URLS FOUND ON THIS PAGE!<br />"; }
  4. I am trying to run a php code on my site but it kept on saying page cannot be found. Any idea why its saying that???
  5. I am trying to get content from a website but it doesnt seem to be working. It creates a table and the columns needed but after that the code is not reading. This is the part thats on the site and I just want to get the href bit "index.aspx". for( $i = 0; $i < $numSitemapPages; $i++ ) { if($_ECHO) echo "Page $i<br />"; $fileContents = file_get_contents( "http://www.website.co.uk/SiteMap" . $i . ".aspx" ); $html->load( $fileContents ); $hrefs = $html->find( "<a[style=color: Blue; text-decoration: underline;]" ); if ( isset( $hrefs[ 0 ] ) ) { foreach( $hrefs as $href ) { $url = "http://www.website.co.uk/" . $href->href; $qry = "INSERT INTO SITEMAPP (url) VALUES( '$url' )"; //echo $url; mysql_query( $qry, $con ); if($_ECHO) echo "MYSQL: Added $href->href to DB<br />"; } } else if($_ECHO) echo "NO URLS FOUND ON THIS PAGE!<br />"; } This is the for loop statement which should work. But not working. any idea why???
  6. Thank you for helping. I have tired your code and it works for phpfreak.com/sitemap but not for the website I want to try. I dont need the title I just want the URL for these titles. Lets ssay for example http://www.php.net/sitemap.php You know how they have different link eg. Homepage, News Archives ect. I want each of the URL to be printed then I can import that to database. So for homepage it would be > http://www.php.net/index.php
  7. First of all I have no idea how to do this. But I know it can be done. A little help would be alot for me. Thank you in advance. So I want to go through a sitemap and visit each of the link on the sitemap and save the URL on to a database. Example: Lets say this was on the sitemap and it just continues with other product like this. I want to write a code where it will go to the first link and saves the product URL on to the database and continues to do the same until the last link. On my example it would be HP 5550DN A3 Colour Laser Printer. Any help??? Any ideas?? I am not asking someone to write the code for me.. Just need help and good direction
  8. Thank you. I tried few sql query but didnt work. You guys always save me
  9. I want to replace everything that is blank field to "Welcome to the page" Eg. Productid Inbox 0012 something is in here 0011 0010 something is in here 0015 so for 0011 and 0015 I want to put " Welcome to the page" but there are many other productid with empty inbox.
  10. Thank you so much for everyone answer. I am a her. ... I apologies for my confusion. Without the strip tag.. it shows All i wanted to do is... get rid of and Thats all.
  11. I have a paragrpah which has tags that needs to be stripped off. so the paragraph looks like I want it to look like How would I go on about doing this.. currently i use $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" ); if ( isset( $inbox[ 0 ] ) ) { $box =( $inbox[0] ); $box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box; } else { $box = "0"; }
  12. Yep I just found it. I am using box = strip_tags( $inbox[0] ); to strip everything so the <br> get stripped. I have removed that but now i am getting something like <div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem"> <p> HP LaserJet 9050 printer<br/> Power cord<br/> Parallel cable<br/> HP LaserJet Q8543X Smart print cartridge<br/> Printer documentation<br/> Printer software CD<br/> Control panel overlay<br/> Face-up output bin<br/> Two 500-sheet input tray<br/> 100 Sheet Multipurpose Tray<br/> HP JetDirect Fast</p> </div> I dont want and What would I need to do in order to remove the div
  13. $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" ); if ( isset( $inbox[ 0 ] ) ) { // Tidy it up - remove commas and weird Word chars $box = strip_tags( $inbox[0] ); //$box = substr( $box, strpos( $box, ";" ) + 1 ); $box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box; $box = str_replace("</ br>", ".", $box ); // this is where I am trying to replace the <br> with a full stop } else { $box = "0"; } I am not striping <br>. when I try to get it from the website. All the information is in one paragraph..
  14. I am trying to replace <br> with a full stop. or <br> $box = str_replace('<br>', ".", $box ); or $box = str_replace('<br>', '<br>', $box ); but its not working...
  15. I am trying to get information from a website and these information are seperated by <br> When I import this to the database it becomes How would I get it exactly how it looks. so it doesnt print in one paragraph. this is the code I am using.. $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" ); if ( isset( $inbox[ 0 ] ) ) { // Tidy it up - remove commas and weird Word chars $box = strip_tags( $inbox[0] ); //$box = substr( $box, strpos( $box, ";" ) + 1 ); $box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box; $box = str_replace("", "<br>", $box ); } else { $box = "0"; }
×
×
  • 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.