GoFuckBiz.info
Форум успешных вебмастеров - GoFuckBiz.info
SEO · трафик · партнерские программы

   - Gofuckbiz.com > - > , > Curl - .

: Curl - .

04.07.2009, 12:56
Shing
<?php // Initialize the CURL library

$cURL = curl_init();

// Set the URL to execute

curl_setopt($cURL, CURLOPT_URL, http://www.domain.com/1.txt);

curl_setopt($cURL, CURLOPT_HEADER, 0);

curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);

// Execute, saving results in a variable

$strPage = curl_exec($cURL);

// Close CURL resource

curl_close($cURL);

// This will print out the HTML contents

echo($strPage);

?>

?
?
1.txt html.
php curl , .
04.07.2009, 13:23
[[seomafia]]
? 1.txt.
?
include('1.txt');
exec('1.txt');
04.07.2009, 13:37
yohoho1
curl_setopt($cURL, CURLOPT_URL, http://www.domain.com/1.txt);
.
04.07.2009, 13:59
Shing
.

:) !
04.07.2009, 14:00
Shing
];178310'] ? 1.txt.
?

.
.
04.07.2009, 14:37
Fred
Curl' ? file_get_contents ?
04.07.2009, 14:45
oso
, ,
04.07.2009, 15:50
JMen
file_get_contents. ( - :) )
04.07.2009, 16:31
Bananz
fgc , libcurl
04.07.2009, 17:16
[[seomafia]]
fgc , libcurl

(http://russianblog.brainitup.com/index.php/2008/09/30/sravnitelnyjj-test-na-skorost-curl-vs-file_get_contents/) :hi:
04.07.2009, 17:21
ziavra
];178381'] (http://russianblog.brainitup.com/index.php/2008/09/30/sravnitelnyjj-test-na-skorost-curl-vs-file_get_contents/) :hi:

, , . , , - 2 .
04.07.2009, 18:02
Bananz
-bash-3.2# php ./curl.php
CURL:1.4210891723633
FGC:0.5161988735199
SCHEME:0.46960401535034
SOCKET:0.47101497650146


<?php
$useUrl = 'http://vz.ru/';
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}

function getPage($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}

function getPage2($url) {
$handle = fopen($url, "r");
$total = '';
while (!feof($handle)) {
$total .= fread($handle, 8192);
}
fclose($handle);
return $total;
}

function getPage3($url) {
$m = explode("/",$url);
$host = $m[2];
array_shift($m);
array_shift($m);
array_shift($m);
$total = '';
$handle = fsockopen($url, 80);
$str = "GET /".implode('/', $m)." HTTP/1.0\r\n".
"Host: ".$host."\r\n"."\r\n";
fwrite($handle, $str);
while (!feof($handle)) {
$total .= fread($handle, 8192);
}
fclose($handle);
return $total;
}

$start = getmicrotime();
getPage($useUrl);
$end = getmicrotime();
echo "CURL:".($end-$start)."\n";

$start = getmicrotime();
$z=file($useUrl);
$end = getmicrotime();
echo "FGC:".($end-$start)."\n";

$start = getmicrotime();
getPage2($useUrl);
$end = getmicrotime();
echo "SCHEME:".($end-$start)."\n";

$start = getmicrotime();
getPage3($useUrl);
$end = getmicrotime();
echo "SOCKET:".($end-$start)."\n";



-bash-3.2# php ./curl.php
CURL:0.6472430229187
FGC:0.47049999237061
SCHEME:0.469407081604
SOCKET:0.46988391876221
-bash-3.2# php ./curl.php
CURL:0.50555300712585
FGC:0.47051906585693
SCHEME:0.46948599815369
SOCKET:0.47000193595886
-bash-3.2# php ./curl.php
CURL:0.87989401817322
FGC:0.47043204307556
SCHEME:0.47042989730835
SOCKET:0.46989893913269
-bash-3.2#


?
04.07.2009, 18:14
dveredel
:
<?php
$url = 'http://lenta.ru';
$t1 = $t2 = 0;

for($i=0;$i<20;$i++) {
$tmp = microtime(true);
$ch = curl_init($url.'?'.rand());
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$t1 += microtime(true)-$tmp;

$tmp = microtime(true);
$resutl = file_get_contents($url.'?'.rand());
$t2 += microtime(true)-$tmp;
}

echo "Curl: $t1<br>FGS: $t2";
?>

Curl: 2.3108081817627
FG: 3.7066597938538

Curl: 2.2540092468262
FG: 3.9852707386017

Curl: 2.2337591648102
FG: 2.5732133388519

Curl: 2.2384498119354
FG: 2.6073923110962

Curl: 2.513343334198
FG: 2.596785068512
04.07.2009, 18:32
oso
, , file_get_contents. ( - :) )
?
04.07.2009, 18:45
Bananz
, , ( keep-alive) __
, fgc ( )

:
-fgc
-curl

curl __ scheme-based , curl - .

, :)
04.07.2009, 18:46
JMen
: /fgc

microsoft: 1.51398396492/1.0944890975952
google: 0.36146211624146/0.53821206092834
some: 0.69859313964844/0.60874319076538
static: 3.8501799106598/3.5867750644684

4 . fgc. fgc - (google). fgc (microsoft). .

. .
04.07.2009, 18:49
JMen
- - , .. ( ).
04.07.2009, 18:52
JMen
, getPage2 , getPage3 - , :)))
04.07.2009, 18:54
Bananz
,
fgc , , :)

vBulletin® 3.8.4. Copyright ©2000-2010, Jelsoft Enterprises Ltd. : zCarot