projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
bb637c3
)
- print doesn't like commas
author
Michael Wallner
<mike@php.net>
Mon, 12 Sep 2005 14:08:57 +0000
(14:08 +0000)
committer
Michael Wallner
<mike@php.net>
Mon, 12 Sep 2005 14:08:57 +0000
(14:08 +0000)
docs/examples/Parallel_Requests.php
patch
|
blob
|
history
docs/examples/Parallel_Requests_.php
patch
|
blob
|
history
docs/examples/Simple_Feed_Aggregator.php
patch
|
blob
|
history
docs/examples/tutorial.txt
patch
|
blob
|
history
diff --git
a/docs/examples/Parallel_Requests.php
b/docs/examples/Parallel_Requests.php
index 962ea0527463a72457416f27c0fb1875edc1a0ec..474adafdeb6a2c774be8c090ee2d5c206a97acfb 100644
(file)
--- a/
docs/examples/Parallel_Requests.php
+++ b/
docs/examples/Parallel_Requests.php
@@
-14,7
+14,7
@@
try {
$p->send();
// HttpRequestPool implements an iterator over attached HttpRequest objects
foreach ($p as $r) {
$p->send();
// HttpRequestPool implements an iterator over attached HttpRequest objects
foreach ($p as $r) {
-
print
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
+
echo
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
}
} catch (HttpException $e) {
print $e;
}
} catch (HttpException $e) {
print $e;
diff --git
a/docs/examples/Parallel_Requests_.php
b/docs/examples/Parallel_Requests_.php
index e1eb88f52c6f3f27c519954cd084e5f4122431ad..94c69df2e0cc612e3acb9c6e7e96fa0fc3c75141 100644
(file)
--- a/
docs/examples/Parallel_Requests_.php
+++ b/
docs/examples/Parallel_Requests_.php
@@
-13,7
+13,7
@@
class Pool extends HttpRequestPool
// while the requests are being executed
print "Executing requests";
for ($i = 0; $this->socketPerform(); $i++) {
// while the requests are being executed
print "Executing requests";
for ($i = 0; $this->socketPerform(); $i++) {
- $i %
3
or print ".";
+ $i %
10
or print ".";
if (!$this->socketSelect()) {
throw new HttpException("Socket error!");
}
if (!$this->socketSelect()) {
throw new HttpException("Socket error!");
}
@@
-24,7
+24,7
@@
class Pool extends HttpRequestPool
try {
foreach (new Pool as $r) {
try {
foreach (new Pool as $r) {
-
print
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
+
echo
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
}
} catch (HttpException $ex) {
print $e;
}
} catch (HttpException $ex) {
print $e;
diff --git
a/docs/examples/Simple_Feed_Aggregator.php
b/docs/examples/Simple_Feed_Aggregator.php
index fd7ade47e17ce4b6ba4c9529d6441d5162bd4ec8..c28e83873fa2cb09429dd01d324aec327ba777e5 100644
(file)
--- a/
docs/examples/Simple_Feed_Aggregator.php
+++ b/
docs/examples/Simple_Feed_Aggregator.php
@@
-38,7
+38,7
@@
class FeedAggregator
{
$pool = new HttpRequestPool;
foreach ($urls as $url) {
{
$pool = new HttpRequestPool;
foreach ($urls as $url) {
- $pool->attach($this->setupRequest($url));
+ $pool->attach($
r = $
this->setupRequest($url));
}
$pool->send();
}
$pool->send();
@@
-74,7
+74,7
@@
class FeedAggregator
protected function loadFeed($file)
{
protected function loadFeed($file)
{
- if (isset($this->feeds[$file]) {
+ if (isset($this->feeds[$file])
)
{
if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
return $data;
} else {
if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
return $data;
} else {
@@
-93,7
+93,7
@@
class FeedAggregator
$file = $this->url2name($url);
if (isset($this->feeds[$file])) {
$file = $this->url2name($url);
if (isset($this->feeds[$file])) {
- $r->
add
Options(array('lastmodified' => $this->feeds[$file]));
+ $r->
set
Options(array('lastmodified' => $this->feeds[$file]));
}
return $r;
}
return $r;
@@
-108,7
+108,7
@@
class FeedAggregator
if (!strlen($body = $r->getResponseBody())) {
throw new Exception("Received empty feed from ". $r->getUrl());
}
if (!strlen($body = $r->getResponseBody())) {
throw new Exception("Received empty feed from ". $r->getUrl());
}
- $this->saveFeed($
file
, $body);
+ $this->saveFeed($
this->url2name($r->getUrl())
, $body);
}
}
}
}
}
}
diff --git
a/docs/examples/tutorial.txt
b/docs/examples/tutorial.txt
index 0a629ee47d8807daba4e8e97561a0593b0f83ffa..d8d9fad84581dd48afd41703bc5d456f5feaf6f9 100644
(file)
--- a/
docs/examples/tutorial.txt
+++ b/
docs/examples/tutorial.txt
@@
-93,7
+93,7
@@
try {
$p->send();
// HttpRequestPool implements an iterator over attached HttpRequest objects
foreach ($p as $r) {
$p->send();
// HttpRequestPool implements an iterator over attached HttpRequest objects
foreach ($p as $r) {
-
print
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
+
echo
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
}
} catch (HttpException $e) {
print $e;
}
} catch (HttpException $e) {
print $e;
@@
-121,7
+121,7
@@
class Pool extends HttpRequestPool
// while the requests are being executed
print "Executing requests";
for ($i = 0; $this->socketPerform(); $i++) {
// while the requests are being executed
print "Executing requests";
for ($i = 0; $this->socketPerform(); $i++) {
- $i %
3
or print ".";
+ $i %
10
or print ".";
if (!$this->socketSelect()) {
throw new HttpException("Socket error!");
}
if (!$this->socketSelect()) {
throw new HttpException("Socket error!");
}
@@
-132,7
+132,7
@@
class Pool extends HttpRequestPool
try {
foreach (new Pool as $r) {
try {
foreach (new Pool as $r) {
-
print
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
+
echo
"Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
}
} catch (HttpException $ex) {
print $e;
}
} catch (HttpException $ex) {
print $e;
@@
-263,7
+263,7
@@
class FeedAggregator
{
$pool = new HttpRequestPool;
foreach ($urls as $url) {
{
$pool = new HttpRequestPool;
foreach ($urls as $url) {
- $pool->attach($this->setupRequest($url));
+ $pool->attach($
r = $
this->setupRequest($url));
}
$pool->send();
}
$pool->send();
@@
-299,7
+299,7
@@
class FeedAggregator
protected function loadFeed($file)
{
protected function loadFeed($file)
{
- if (isset($this->feeds[$file]) {
+ if (isset($this->feeds[$file])
)
{
if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
return $data;
} else {
if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
return $data;
} else {
@@
-318,7
+318,7
@@
class FeedAggregator
$file = $this->url2name($url);
if (isset($this->feeds[$file])) {
$file = $this->url2name($url);
if (isset($this->feeds[$file])) {
- $r->
add
Options(array('lastmodified' => $this->feeds[$file]));
+ $r->
set
Options(array('lastmodified' => $this->feeds[$file]));
}
return $r;
}
return $r;
@@
-333,7
+333,7
@@
class FeedAggregator
if (!strlen($body = $r->getResponseBody())) {
throw new Exception("Received empty feed from ". $r->getUrl());
}
if (!strlen($body = $r->getResponseBody())) {
throw new Exception("Received empty feed from ". $r->getUrl());
}
- $this->saveFeed($
file
, $body);
+ $this->saveFeed($
this->url2name($r->getUrl())
, $body);
}
}
}
}
}
}