Results 1 to 5 of 5

Thread: [RESOLVED] Help using strpos to find a text data in string from remote html

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Resolved [RESOLVED] Help using strpos to find a text data in string from remote html

    Hi all i am trying to use strpos( ..) function to find some data in string from a remote page using curl. My curl is working well since i used print $result; and the html page got loaded with in the script . But the scrip never be able to find the "This profile is set to private. " with the following html ( in remote page):

    Code:
     <span id="ctl00_Main_ctl00_ctrlMessage">This profile is set to private. This user must add you as a friend to see his/her profile.</span>
    I be happy if some one tell me what i am doing wrong.Thanks

    PHP Code:

    curl_setopt
    ($curlCURLOPT_URL'http://www.myspace.com/' $_POST['url']);
            
    curl_setopt($curlCURLOPT_POST0);
            
    $result curl_exec($curl);
            
    $headers curl_getinfo($curl);
        
            if (
    strpos($result'This profile is set to private.'))
                    {
                          echo 
    "found";
                       
                    }
                    else
                    {
                         echo 
    "Not found";
                    } 
    part html:



    HTML Code:
     <span id="ctl00_Main_ctl00_ctrlMessage">This profile is set to private. This user must add you as a friend to see his/her profile.</span>
    
    Last edited by tony007; Jun 17th, 2008 at 12:26 AM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Help using strpos to find a text data in string from remote html

    I fixed it by changing 'This profile is set to private.' to "This profile is set to private." :-)

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] Help using strpos to find a text data in string from remote html

    They both look identical to me
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: [RESOLVED] Help using strpos to find a text data in string from remote html

    I mean i had to add " instead of just ' around the searching string

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] Help using strpos to find a text data in string from remote html

    Anyhow, you should be using the strict comparison operator when using strpos:

    if (strpos($result, 'This profile is set to private.') !== false)
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width