note 49692 added to function.curl-init
| From: | Jos�EnriqueSerranoExp�sito at osu1 dot php dot net | Date: | Fri, 04 Feb 2005 22:35:37 +0000 |
| Subject: | note 49692 added to function.curl-init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84546@lists.php.net to get a copy of this message | ||
<?php
vWritePageToFile( 'http://es.php.net',
'es.php.net.txt' );
?>
... And the text file stand in the server in the same folder that the script.
This is the function code.-
<?php
function vWritePageToFile( $sHTMLpage, $sTxtfile ) {
$sh = curl_init( $sHTMLpage );
$hFile = FOpen( $sTxtfile, 'w' );
curl_setopt( $sh, CURLOPT_FILE, $hFile );
curl_setopt( $sh, CURLOPT_HEADER, 0 );
curl_exec ( $sh );
$sAverageSpeedDownload = curl_getInfo( $sh, CURLINFO_SPEED_DOWNLOAD );
$sAverageSpeedUpload = curl_getInfo( $sh, CURLINFO_SPEED_UPLOAD );
echo '<pre>';
echo 'Average speed download == ' . $sAverageSpeedDownload . '<br>';
echo 'Average Speed upload == ' . $sAverageSpeedUpload . '<br>';
echo '<br>';
$aCURLinfo = curl_getInfo( $sh );
print_r( $aCURLinfo );
echo '</pre>';
curl_close( $sh );
FClose ( $hFile );
echo '(<b>See the file "'.$sTxtfile.'" in the same path of the
hosting'.
' to where this script PHP</b>).<br>';
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.curl-init.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49692
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49692&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49692&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49692&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49692&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49692&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49692&report=yes
Search -- http://master.php.net/manage/user-notes.php