Web Analytics Made Easy -
StatCounter Please help with own Search Function - CodingForum

Announcement

Collapse
No announcement yet.

Please help with own Search Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Please help with own Search Function

    I have many urls. For example:
    /urls/yeah.html
    /urls/yeah2.html
    /urls/yeah3.html
    /urls/yeah4.html

    I have also a main page that has a search box where you can type for example "welcome" and then hit Search button. Then it should display ALL sentences that contains word "welcome" in those urls above. How would you do that?

    I know how to fetch info from urls with fsockopen and then use preg_match to see if there is text but can you write me a regular expression?

    "hello and welcome to my world! It's beautiful day today!!"

    If I search now for welcome it should return: "hello and welcome to my world!". But if I search for a word "it", it will return me: "It's beautiful day today!!" - so the sentences that has the word.

    Possible? Thanks for any help! Really need this!
    PHP 5 & MySQL 5 (Y)

  • #2
    And if someone can answer me why this doesn't work?

    $fp = fsockopen("psychclassics.yorku.ca/Abbott",80,$errno,$errstr,0.5);

    It does not create sock connection
    PHP 5 & MySQL 5 (Y)

    Comment


    • #3
      And what are the values of $errno and $errstr after the function call?

      Comment


      • #4
        Okay I got it now. But can someone help me out with this problem:

        "dsfsdfshttp://www.sdg.com/drgfd/fdfg.html;sdfgfgd"

        It should preg_match the http://www.sdg.com/drgfd/fdfg.html; part of the text, it always starts with http:// and ends with ;, help?
        PHP 5 & MySQL 5 (Y)

        Comment


        • #5
          PHP Code:
          preg_match('/(http:\/\/.*?;)/is'"dsfsdfshttp://www.sdg.com/drgfd/fdfg.html;sdfgfgd"); 

          Comment


          • #6
            Thanks.

            Btw, how do you check a start? if ?; is the end, how to check start?
            PHP 5 & MySQL 5 (Y)

            Comment

            Working...
            X