|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi!
I have a server I'd like to download hundreds of pages from, and only get the first few kilobytes of every page to save resources on both my and the remote end. Since the server doesn't support HTTP range to use it in curl like curl_setopt($ch, CURLOPT_RANGE, "0-5000"); I started looking around and found that using the custom write function I might be able to do the same. As I understand it, closing the handle and thus terminating the transfer from within the callback function is not possible, so I'm a bit stuck.. How could I get this done? Could someone paste me a fewliner example? Thanks in advance Andrew |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Hi,
You can terminate the download in your WRITEFUNCTION callback by returning 0. Here's an example: <? error_reporting(E_ALL | E_STRICT); // This class encapsulates the callback functions class curlHandler { var $data; var $readCount = 0; var $maxRead = 20000; function writeProc($ch, $str) { $len = strlen($str); $n = min($this->maxRead - $this->readCount, $len); $this->data .= substr($str, 0, $n); $this->readCount += $n; echo "Read {$this->readCount} bytes (max {$this->maxRead}).<br> \n"; if ($this->readCount >= $this->maxRead) { return 0; } return $len; } } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.php.net'); $cp = new curlHandler; curl_setopt($ch, CURLOPT_WRITEFUNCTION, array(&$cp, 'writeProc')); curl_exec($ch); echo "<br>\nGot " . strlen($cp->data) . " bytes.<br><br>\n\n"; echo "CURL statistics:<br><br>\n\n"; $info = curl_getinfo($ch); var_dump($info); curl_close($ch); ?> Regards, John Peters On Feb 26, 11:54 am, "shika...@gmail.com" <shika...@gmail.com> wrote: > Hi! > > I have a server I'd like to download hundreds of pages from, and only > get the first few kilobytes of every page to save resources on both > my > and the remote end. Since the server doesn't support HTTP range to > use it in curl like curl_setopt($ch, CURLOPT_RANGE, "0-5000"); I > started looking around and found that using the custom write function > I might be able to do the same. > > As I understand it, closing the handle and thus terminating the > transfer from within the callback function is not possible, so I'm a > bit stuck.. > > How could I get this done? Could someone paste me a fewliner example? > > Thanks in advance > Andrew |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote:
> Hi, Hey John, which part of "Please do not top post" is it that you are having trouble understanding? |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Captain Paralytic,
If you *MUST* make an off topic post, please preface the subject with "[OT]", so those who are not interested in OT posts can skip them. On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: > On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: > > > Hi, > > Hey John, > which part of "Please do not top post" is it that you are having > trouble understanding? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
esaniah@gmail.com wrote:
> On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: >> On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: >> >>> Hi, >> Hey John, >> which part of "Please do not top post" is it that you are having >> trouble understanding? > > > Captain Paralytic, > > If you *MUST* make an off topic post, please preface the subject with > "[OT]", so those who are not interested in OT posts can skip them. > (Top posting fixed) It is not off topic in this newsgroup to ask people to not top post. Intertwined or bottom posting is the norm for this newsgroup. Please don't top post! -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
esaniah@gmail.com wrote:
> On Feb 28, 9:19 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> esan...@gmail.com wrote: >>> On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: >>>> On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: >>>>> Hi, >>>> Hey John, >>>> which part of "Please do not top post" is it that you are having >>>> trouble understanding? >> > Captain Paralytic, >> > >> > If you *MUST* make an off topic post, please preface the subject with >> > "[OT]", so those who are not interested in OT posts can skip them. >> > >> >> (Top posting fixed) >> >> It is not off topic in this newsgroup to ask people to not top post. >> Intertwined or bottom posting is the norm for this newsgroup. >> >> Please don't top post! >> > Jerry, > > You're completely misrepresenting the newsgroup's charter. > > "comp.lang.php is intended to be a global forum for the discussion of > issues involving PHP ... Since database connectivity is a large part > of PHP, it will be considered topical in comp.lang.php." > > PHP and databases are on-topic. Posting styles are not. How hard is it > to use [OT] like everyone else? > (Top posting fixed again) Because suggesting people follow the norms for this newsgroup is within the bounds of the newsgroup. Period. You can keep top posting if you want - but don't expect to get much from this newsgroups. A. Because they are either idiots or assholes. Q. Why do people continue to top post? A. We politely let them know the correct way to post. Q. What do you do about it? A. Because they don't know any better. Q. Why do people top post? A. Because it interrupts the normal flow of the messages. Q. Why is it so annoying? A. Top posting. Q. What's the most annoying thing on usenet? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Jerry,
You're completely misrepresenting the newsgroup's charter. "comp.lang.php is intended to be a global forum for the discussion of issues involving PHP ... Since database connectivity is a large part of PHP, it will be considered topical in comp.lang.php." PHP and databases are on-topic. Posting styles are not. How hard is it to use [OT] like everyone else? On Feb 28, 9:19 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > esan...@gmail.com wrote: > > On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: > >> On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: > > >>> Hi, > >> Hey John, > >> which part of "Please do not top post" is it that you are having > >> trouble understanding? > > > Captain Paralytic, > > > > If you *MUST* make an off topic post, please preface the subject with > > "[OT]", so those who are not interested in OT posts can skip them. > > > > (Top posting fixed) > > It is not off topic in this newsgroup to ask people to not top post. > Intertwined or bottom posting is the norm for this newsgroup. > > Please don't top post! > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Jerry,
Whining about posting styles is not and has never been on topic for this newsgroup. If you are interested in improving the single-to-noise ratio in this group, you will follow the same standards that everyone else does and use "[OT]" when discussing topics unrelated to PHP and databases. If you wish to continue posting off-topic content without warning folks, that's a quick way to get yourself kill-filed by a large number of readers. On Feb 28, 10:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > esan...@gmail.com wrote: > > On Feb 28, 9:19 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > >> esan...@gmail.com wrote: > >>> On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: > >>>> On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: > >>>>> Hi, > >>>> Hey John, > >>>> which part of "Please do not top post" is it that you are having > >>>> trouble understanding? > >> > Captain Paralytic, > > >> > If you *MUST* make an off topic post, please preface the subject with > >> > "[OT]", so those who are not interested in OT posts can skip them. > > >> (Top posting fixed) > > >> It is not off topic in this newsgroup to ask people to not top post. > >> Intertwined or bottom posting is the norm for this newsgroup. > > >> Please don't top post! > > > Jerry, > > > > You're completely misrepresenting the newsgroup's charter. > > > > "comp.lang.php is intended to be a global forum for the discussion of > > issues involving PHP ... Since database connectivity is a large part > > of PHP, it will be considered topical in comp.lang.php." > > > > PHP and databases are on-topic. Posting styles are not. How hard is it > > to use [OT] like everyone else? > > > > (Top posting fixed again) > > Because suggesting people follow the norms for this newsgroup is within > the bounds of the newsgroup. Period. > > You can keep top posting if you want - but don't expect to get much > from this newsgroups. > > A. Because they are either idiots or assholes. > Q. Why do people continue to top post? > A. We politely let them know the correct way to post. > Q. What do you do about it? > A. Because they don't know any better. > Q. Why do people top post? > A. Because it interrupts the normal flow of the messages. > Q. Why is it so annoying? > A. Top posting. > Q. What's the most annoying thing on usenet? > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
esaniah@gmail.com wrote:
> On Feb 28, 10:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> esan...@gmail.com wrote: >>> On Feb 28, 9:19 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >>>> esan...@gmail.com wrote: >>>>> On Feb 28, 8:09 am, Captain Paralytic <paul_laut...@yahoo.com> wrote: >>>>>> On 28 Feb, 14:04, petersprc <peters...@gmail.com> wrote: >>>>>>> Hi, >>>>>> Hey John, >>>>>> which part of "Please do not top post" is it that you are having >>>>>> trouble understanding? >>>> > Captain Paralytic, >>>> > If you *MUST* make an off topic post, please preface the subject with >>>> > "[OT]", so those who are not interested in OT posts can skip them. >>>> (Top posting fixed) >>>> It is not off topic in this newsgroup to ask people to not top post. >>>> Intertwined or bottom posting is the norm for this newsgroup. >>>> Please don't top post! >> > Jerry, >> > >> > You're completely misrepresenting the newsgroup's charter. >> > >> > "comp.lang.php is intended to be a global forum for the discussion of >> > issues involving PHP ... Since database connectivity is a large part >> > of PHP, it will be considered topical in comp.lang.php." >> > >> > PHP and databases are on-topic. Posting styles are not. How hard is it >> > to use [OT] like everyone else? >> > >> >> (Top posting fixed again) >> >> Because suggesting people follow the norms for this newsgroup is within >> the bounds of the newsgroup. Period. >> >> You can keep top posting if you want - but don't expect to get much >> from this newsgroups. >> >> A. Because they are either idiots or assholes. >> Q. Why do people continue to top post? >> A. We politely let them know the correct way to post. >> Q. What do you do about it? >> A. Because they don't know any better. >> Q. Why do people top post? >> A. Because it interrupts the normal flow of the messages. >> Q. Why is it so annoying? >> A. Top posting. >> Q. What's the most annoying thing on usenet? >> > Jerry, > > Whining about posting styles is not and has never been on topic for > this newsgroup. If you are interested in improving the single-to-noise > ratio in this group, you will follow the same standards that everyone > else does and use "[OT]" when discussing topics unrelated to PHP and > databases. > > If you wish to continue posting off-topic content without warning > folks, that's a quick way to get yourself kill-filed by a large number > of readers. > (Top posting fixed) No, you're just showing what an ass you are by continuing to top post. Go ahead and plonk me if you want. I'm sure a lot of other regulars in this group have already *plonked you*. But that's what happens when you get a troll coming in through google groups. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
You're doing nothing other than spamming comp.lang.php.
If you feel the need to make off-topic comments, put [OT] in the subject like the previous poster already told you to do, so that the rest of us can skip this junk. It's basic netiquette. Take it to a more appropriate forum please. -- Tom Stewart, ATC > (Top posting fixed) > > No, you're just showing what an ass you are by continuing to top post. > Go ahead and plonk me if you want. I'm sure a lot of other regulars in > this group have already *plonked you*. > > But that's what happens when you get a troll coming in through google > groups. > |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
You don't undesrtand the purpose of this newsgroup which is to discuss PHP and not your favorite posting
style. Stay on topic please. -- Tom Stewart, ATC Ivan Marsh <annoyed@you.now> wrote: > On Fri, 29 Feb 2008 10:22:55 -0800, esaniah wrote: > >> Jerry, >> >> Whining about posting styles is not and has never been on topic for this >> newsgroup. If you are interested in improving the single-to-noise ratio >> in this group, you will follow the same standards that everyone else >> does and use "[OT]" when discussing topics unrelated to PHP and >> databases. > > You couldn't be more wrong. By top posting you have turned the thread into > a thread about top posting. > > Please don't top post. > |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
Jerry is a key contributor to this newsgroup and his
posts are filled with valuable insights. However, his contribution to this thread is spam and goes against comp.lang.php's charter. You're capable of a lot better, Jerry. -- Tom Stewart, ATC Tom Stewart <tichini@gmail.com> wrote: > You're doing nothing other than spamming comp.lang.php. > > If you feel the need to make off-topic comments, put [OT] in the subject like the previous poster already > told you to do, so that the rest of us can skip this junk. It's basic netiquette. > > Take it to a more appropriate forum please. > >> >> (Top posting fixed) >> >> No, you're just showing what an ass you are by continuing to top post. >> Go ahead and plonk me if you want. I'm sure a lot of other regulars in >> this group have already *plonked you*. >> >> But that's what happens when you get a troll coming in through google >> groups. |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
Tom Stewart wrote:
> You're doing nothing other than spamming comp.lang.php. > > If you feel the need to make off-topic comments, put [OT] in the subject like the previous poster already > told you to do, so that the rest of us can skip this junk. It's basic netiquette. > > Take it to a more appropriate forum please. > Bullshit. I'm doing nothing more than calling you what you are - an asshole. You come in here new and try to tell all the regulars what's off topic? You really are an ass. Do us all a favor. Crawl back into your hole and get lost. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
Tom Stewart wrote:
> Jerry is a key contributor to this newsgroup and his > posts are filled with valuable insights. > > However, his contribution to this thread is spam and > goes against comp.lang.php's charter. > > You're capable of a lot better, Jerry. > No, you're just an asshole. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
Tom Stewart wrote:
> Your opinion in this thread doesn't count for much. > It count for a lot more than a top posting asshole. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
Tom Stewart wrote:
> You lost credibility in this thread when you resorted > to ad-hominem attacks instead of simply following the > established rules like everyone else. > > All you've proven is that you're intent on being a > disruption. > No, you lost credibility when you started top posting and made an ass of yourself when people tried to gently correct you. Sorry, you're the idiot here. As you continue to prove. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
You lost credibility in this thread when you resorted
to ad-hominem attacks instead of simply following the established rules like everyone else. All you've proven is that you're intent on being a disruption. -- Tom Stewart, ATC Jerry Stuckle <jstucklex@attglobal.net> wrote: > Tom Stewart wrote: >> You're doing nothing other than spamming comp.lang.php. >> >> If you feel the need to make off-topic comments, put [OT] in the subject like the previous poster already >> told you to do, so that the rest of us can skip this junk. It's basic netiquette. >> >> Take it to a more appropriate forum please. >> > > Bullshit. I'm doing nothing more than calling you what you are - an > asshole. > > You come in here new and try to tell all the regulars what's off topic? > > You really are an ass. Do us all a favor. Crawl back into your hole > and get lost. > |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
Your opinion in this thread doesn't count for much.
-- Tom Stewart, ATC Jerry Stuckle <jstucklex@attglobal.net> wrote: > > No, you're just an asshole. > |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
You've sent at lease 10 pieces of spam just in this
one thread. You can continue denying and resisting the rules, but you're only digging yourself into a deeper hole. Try studying this: http://en.wikipedia.org/wiki/Off-topic "Internet trolls will sometimes post off topic messages deliberately on internet forums to aggravate members or hijack a discussion." And read the charter, if you can find it. -- Tom Stewart, ATC Jerry Stuckle <jstucklex@attglobal.net> wrote: > > No, you lost credibility when you started top posting and made an ass of > yourself when people tried to gently correct you. > > Sorry, you're the idiot here. As you continue to prove. > |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
You mean "counts." You're sorely mistaken if you
think a spammer's opinion has any merit here. Jerry Stuckle <jstucklex@attglobal.net> wrote: > > It count for a lot more than a top posting asshole. > |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
Tom Stewart <tichini@gmail.com> wrote:
> You don't undesrtand the purpose of this newsgroup > which is to discuss PHP and not your favorite posting > style. > > Stay on topic please. > Posting off-topic is fine. I don't care. Usenet is an open place that fosters open discussion. Not that I'm saying you were even off-topic, which you were not. -- Tom Stewart, ATC |
|
|
|
#22 |
|
Messages: n/a
Hébergeur: |
Tom Stewart <tichini@gmail.com> wrote:
> You've sent at lease 10 pieces of spam just in this > one thread. I didn't mean to suggest Jerry is in any way spamming.. That's just not true at all. -- Tom Stewart, ATC |
|
![]() |
| Outils de la discussion | |
|
|