Hi Simon,

Try the following for reading the files,

for(i=1;i<2000;i++) {
    
        $response="";
        $request="kbid=$i";
        //Header
        $header =  "POST kb.html HTTP/1.0\r\n";
        $header .= "Content-type: application/x-www-form-urlencoded\r\n";
        $header .= "Content-length: " . strlen($request) . "\r\n\r\n";

        //Open Connection
        $fp = fsockopen("www.mysite.com",80,&$err_num,&$err_msg, 30);
        if($fp) {
                fputs($fp, $header.$request);
                while(!feof($fp))
                $response .= fgets($fp,2048);
                fclose($fp);
        }
        else {
                if(DEBUG) {
                echo "ERR_NUM: $err_num\nERR_MSG: $err_msg";
        }
//write response to a file
echo $response;
}

Hope this helps you,

Wieger


Kraa de Simon wrote:
> 
> Hi,
> 
> PHP newbie.
> 
> Can anyone help me with the following?
> 
> Pseudo code:
> 
> for(i=1;i<2000;i++)
> {
>         catch the output of
>                 http://www.mysite.com/kb.html?kbid= <? echo i ?>
>         and put the html code in a text file called
>                 /www/kb/kbid <? echo i ?> .html
> }
> 
> So the end result is 2000 html files on disk "extacted" from the http://
> address...
> 
> Thanks...
> 
> Met vriendelijke groet / With kind regards,
> 
> Simon de Kraa
> ICL Logistic Systems
> mailto:[EMAIL PROTECTED]
> 
> ---
> 
> Microsoft Windows 2000 Professional SP 1, Progress 9.1b, Roundtable 9.1b
> SCO UnixWare 7.1.1, Progress 9.1a11
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Wieger Uffink
tel: +31 20 428 6868
fax: +31 20 470 6905
web: http://www.usmedia.nl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to