#1
  1. PHP Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    England
    Posts
    163
    Rep Power
    13

    reading a web page into a variable


    Ok, I am still very new to flash and don't have meny good resource sites or books.

    What i wanting to do is read a webpage into a variable, so this variable will contain the HTML content of the page.

    Then i intend on doing some string manipulation etc......

    I know the PHP equivelant is this:

    PHP Code:
    $fp fsockopen ("www.google.com"80$errno$errstr30);  
    if (!
    $fp
    {  
        echo 
    "$errstr ($errno)
    }
    else 
    {  
        fputs (
    $fp, "GET HTTP/1.0\r\nHost:andy\r\n\r\n");  
        
    $temp =  fgets($fp, 1000);  
        while (
    $temp != "\r\n")  
        {  
             
    $headers .= $temp;  
             
    $temp =  fgets($fp, 1000);  
         }  
         while (!feof(
    $fp)) 
         {  
             
    $temp = fgets ($fp,128);  
             
    $content .= $temp;  
         }  
         fclose (
    $fp);  
    }

    print 
    $content
    note that you can specifiy the port no.

    any help would be cool.

    Thanks

    Last edited by andywhitt; March 20th, 2003 at 06:41 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    126
    Rep Power
    12
    hmmm, im not sure that you could read the text of and HTML page in flash alone.. you might have to open it in php or perl and send all the text as one extremely long string to flash using its loadVars object.
  4. #3
  5. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    you can use loadVariables or LoadVars to load in an HTML page, but i wouldn't sugges it. Flash is extremely slow when it comes to parsing etc.. just do it in PHP and re-write it for flash...

    cheers,

    bret

IMN logo majestic logo threadwatch logo seochat tools logo