Doubts in PhP Curl Functions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Velhari
    New Member
    • Sep 2006
    • 46

    #1

    Doubts in PhP Curl Functions

    Hello sir,
    Using Curl Function in PhP, i got the source of a Web page .
    In that I did not want the entire content, like some contents are all not needed so i have to eliminate those contents from the web page source and then remaining things only needed...

    Is it possible in PhP by using Curl Function. If possible means how???

    Please reply......
  • TheMadMidget
    New Member
    • Oct 2006
    • 98

    #2
    Unless the page needs authentication you can just use file_get_conten ts.

    I don't know of a direct way other than seperating the source as a string
    [PHP]
    $start = strpos($str, "start of string you want",) ;
    $end = strpos($str, "end of string you want", $start) + strlen("end of string you want");
    $length = $end - $start;
    $wantedCode = substr($str, $start, $length);
    [/PHP]

    It's a little crude, but works.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      I still wonder why you would have doubts about the cURL functions, seeing your thread title Doubts in PhP Curl Functions ? It gives you just what you asked! What you want to do with the result is your choice, but you cannot blame cURL for that.

      Ronald :cool:

      Comment

      • Velhari
        New Member
        • Sep 2006
        • 46

        #4
        Originally posted by ronverdonk
        I still wonder why you would have doubts about the cURL functions, seeing your thread title Doubts in PhP Curl Functions ? It gives you just what you asked! What you want to do with the result is your choice, but you cannot blame cURL for that.

        Ronald :cool:
        Sir,
        I asked for that query is because of,
        i did the program using Curl Function to get the page which is returned by google for any search string....... I want to show the resulted contents only... Not google related things means, In google search results displayed in window with the Sponsored links, Bottom having Navigation bar containing Paging No's and then Top having search Text box and etc., So these are all not needed for me..... Only the results of Search String only needed......

        So for that only i asked that query, is it possible in Curl function to obtain specific contents from the entire source.

        Plese reply me......

        Comment

        • TheMadMidget
          New Member
          • Oct 2006
          • 98

          #5
          cURL is used for getting the entire response, cURL cannot give you any more or any less, except a success/fail reading, but from that mass of information you can use PHP to take the parts you want.

          Comment

          • Velhari
            New Member
            • Sep 2006
            • 46

            #6
            Originally posted by TheMadMidget
            cURL is used for getting the entire response, cURL cannot give you any more or any less, except a success/fail reading, but from that mass of information you can use PHP to take the parts you want.
            Ok thanks sir,

            I need another help from you sir, If i using preg_match to match for particular pattern in the string, It returns whether it is present or not..... But i want to get the Position of Occurrence of that pattern in that string.. Is it possible means tell me asap

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              You opened a new thread for this last question, so now you start double posting!!

              This thread will be closed.

              Ronald :cool:

              Comment

              Working...