php-general Digest 22 Jan 2007 11:30:22 -0000 Issue 4583
Topics (messages 247520 through 247540):
Re: Script to generate a site thumbnails
247520 by: Nick Stinemates
Re: PHP Functions as XML or DB
247521 by: Sergiu Voicu
247537 by: Roman Neuhauser
Re: problems with sessions variables and virtual domains in apache
247522 by: Chris
Re: most powerful php editor
247523 by: tedd
247524 by: Arno Kuhl
247525 by: Robert Cummings
247526 by: Arno Kuhl
247529 by: Robert Cummings
247530 by: John Meyer
247531 by: Larry Garfield
247532 by: Arno Kuhl
socket_write buffer problem
247527 by: Richard Luckhurst
247528 by: Jochem Maas
247533 by: Richard Luckhurst
247534 by: Richard Luckhurst
247536 by: Richard Luckhurst
247538 by: Stut
247539 by: Jochem Maas
247540 by: Stut
Re: preg_match problem
247535 by: Martin Alterisio
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
An example:
<?php
$imageMagick = "convert"; //name of the application using to convert the
files
$opts = "-thumbnail 800x600 ";
$fileName = "my.jpg";
exec("$imageMagick $opts $fileName thumb.$fileName");
?>
Hope it helps!
--
==================
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org
AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==================
--- End Message ---
--- Begin Message ---
Copy&Paste man ;) (Just kidding) Now, seriously, I myself would write a
parser for this, fetch some raw data from the pages, and do further
processing on those.
I didn't checked yet, but I am almost sure that there may be only a few
variations of the manual's used html template, and I don't think that it
would take you two much time to figure out ways to extract data from
each of this variations.
On the other hand, I think that this would be a good question to be put
on the PHP Manual Mailing List. I am almost sure that somebody already
has done this and can help you with it.
sergiu
WeberSites LTD wrote:
Hi
I'm looking to create a Table that holds all of the PHP Functions, their
description and syntax.
It's all in the manual and I'm trying to extract it from there but I find it
hard since the HTML template is not the same for all the functions.
I may be going about this the wrong way... is there an easier way?
thanks
berber
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-21 17:04:43 +0200:
> I'm looking to create a Table that holds all of the PHP Functions, their
> description and syntax.
>
> It's all in the manual and I'm trying to extract it from there but I find it
> hard since the HTML template is not the same for all the functions.
>
> I may be going about this the wrong way... is there an easier way?
The canonical source for the manual is in DocBook, the various formats
are produced automatically from that.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
esteban wrote:
The don't want to pass the session variable across domains. The problem is
in the main domain, i don't know what happens, the session variable lost the
value or is distroyed.
Track down where is happens with lots of 'error_log' and 'print_r'
calls. Work out where it breaks then I'm sure you'll work out why it's
breaking.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
At 10:05 AM -0400 1/21/07, Miles Thompson wrote:
Which then leads me towards ZEND, although I've never used it.
I purchased the Pro version (ZendStudioClient) but considering that I
couldn't get it to work with my host in real time, I went back to
GoLive for the Mac. That way my develop, upload, and test cycle is
nearly immediate. However, others may have solved this problem more
efficiently than me. I often do things the hard way.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Vinicius C Silva [mailto:[EMAIL PROTECTED]
Sent: 21 January 2007 02:54
To: php-general@lists.php.net
Subject: [PHP] most powerful php editor
hi everyone!
i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?
=================================
There've been lots of good replies to this, and I figured I'll add my 2c
I spent several months trying out many editors and IDE's on the Windows
platform about 3 years ago - all the usual suspects, most have been
mentioned in other replies - and settled on Nusphere's PHPEd (an IDE rather
than an editor). Every year when it comes time to renew my license (which I
had to do 2 weeks ago) I look at what else is available and new, try out the
latest versions of some of the candidates that made it to my short list, and
then renew my license anyway because it's worth every cent and because for
me there's nothing that matches it. There are lots of good editors and a few
good IDE's, but every one I tried had some or other niggle that put me off:
buggy software, slow performance, missing or shallow functionality, bitty
integration, etc. Nusphere's PHPEd was the 2nd most expensive (at the time)
but it hit the sweet spot and I've never regretted buying it. A bonus was
finding that the response from the support forum was good, and updates are
regular and stable and meaningful. A real bonus was finding that the most
recent license renewal is now valid for 3 years instead of 1 year. So I'll
only be looking at the competition again in 3 years time - unlike Stut I
hope this question is asked at least once a year because I'd like to hear
what's new.
For me the analogy goes something like this: if you type the occasional
letter or note then Wordpad is perfectly adequate, but if your livelihood is
churning out professional well-formatted heavy-weight documents then it pays
you to invest in a top-class word processor and supporting tools. The same
goes for an IDE.
Arno
--- End Message ---
--- Begin Message ---
On Mon, 2007-01-22 at 01:22 +0200, Arno Kuhl wrote:
>
> For me the analogy goes something like this: if you type the occasional
> letter or note then Wordpad is perfectly adequate, but if your livelihood is
> churning out professional well-formatted heavy-weight documents then it pays
> you to invest in a top-class word processor and supporting tools. The same
> goes for an IDE.
I think I just vomited in my mouth...
Yep, tastes like bile :|
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: 22 January 2007 01:32
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: RE: [PHP] most powerful php editor
On Mon, 2007-01-22 at 01:22 +0200, Arno Kuhl wrote:
>
> For me the analogy goes something like this: if you type the occasional
> letter or note then Wordpad is perfectly adequate, but if your livelihood
is
> churning out professional well-formatted heavy-weight documents then it
pays
> you to invest in a top-class word processor and supporting tools. The same
> goes for an IDE.
I think I just vomited in my mouth...
Yep, tastes like bile :|
Cheers,
Rob.
--
Hope you get over it :)
So you don't think EditPlus or UltraEdit or Notepad++ (some of the proposed
editors that I consider "Wordpad"-type editors) would be a bit inadequate
for more complex project developments? Some people who've never been exposed
to a really good IDE think this is as good as it gets.
Arno
--- End Message ---
--- Begin Message ---
On Mon, 2007-01-22 at 02:13 +0200, Arno Kuhl wrote:
> -----Original Message-----
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: 22 January 2007 01:32
> To: [EMAIL PROTECTED]
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] most powerful php editor
>
>
> On Mon, 2007-01-22 at 01:22 +0200, Arno Kuhl wrote:
> >
> > For me the analogy goes something like this: if you type the occasional
> > letter or note then Wordpad is perfectly adequate, but if your livelihood
> is
> > churning out professional well-formatted heavy-weight documents then it
> pays
> > you to invest in a top-class word processor and supporting tools. The same
> > goes for an IDE.
>
> I think I just vomited in my mouth...
>
> So you don't think EditPlus or UltraEdit or Notepad++ (some of the proposed
> editors that I consider "Wordpad"-type editors) would be a bit inadequate
> for more complex project developments? Some people who've never been exposed
> to a really good IDE think this is as good as it gets.
Not at all, to each their own. But your comment suggests that one can't
as easily churn out "professional well-formatted heavy-weight documents"
unless one uses a "top-class word processor and supporting tools. The
same goes for an IDE". I strongly disagree. Knowledge, experience, and
attention to detail produces profession well-formatted heavy-weight
documents (in fact more likely lightweight), not the software you use to
type it. There are plenty of monkeys that use your ingredients for
coding and produce drivel.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Dear god Arnot, would you like to stand back for a moment and consider
how retarded those statements are, or would you like for me to do it for
you?
Whether you use a powerful IDE or not, you still have to use the same
compiler underneath. In PHP, that "compiler" is the web server. Unless
you buy an IDE that contains a mini-server for you to test the files,
yoru comparison between IDEs and word processors is ludicrous at best.
>
> On Mon, 2007-01-22 at 01:22 +0200, Arno Kuhl wrote:
>> For me the analogy goes something like this: if you type the occasional
>> letter or note then Wordpad is perfectly adequate, but if your livelihood
> is
>> churning out professional well-formatted heavy-weight documents then it
> pays
>> you to invest in a top-class word processor and supporting tools. The same
>> goes for an IDE.
>
> I think I just vomited in my mouth...
>
> Yep, tastes like bile :|
>
> Cheers,
> Rob.
> --
>
> Hope you get over it :)
>
> So you don't think EditPlus or UltraEdit or Notepad++ (some of the proposed
> editors that I consider "Wordpad"-type editors) would be a bit inadequate
> for more complex project developments? Some people who've never been exposed
> to a really good IDE think this is as good as it gets.
>
> Arno
>
--- End Message ---
--- Begin Message ---
I was originally using PHPEclipse. When I rebuild my computer a few weeks
ago, I decided to give the PHP-IDE package a try (given that Zend is planning
to replace their own first-class IDE with the results of the PHP-IDE work).
In both of them, I found the same major problems:
- Code assistance gets in my way more often than not, and has not once given
me useful help. (Zend Studio is a godsend here.)
- Setting up new projects out of CVS or SVN and managing them is far harder
than it has any right to be. (Zend Studio projects are simply based on a
directory tree, not extra indexing, and works just fine for me.)
- The whole system is an insane memory hog.
- I've not yet figured out how to get it set up with xdebug for easy real-time
debugging. (That feature alone is worth using Zend Studio.) To be fair,
that could just be me not knowing how to do it.
I use Zend Studio at work and love it. I keep trying to find a good open
source development setup for home that will let me not have to spend triple
digits on Zend Studio for home, but so far I've just not found that with
Eclipse.
On Sunday 21 January 2007 2:01 pm, Peter Lauri wrote:
> I don't know what version you are using or what plugin you are using, there
> are more then one plugin :)
>
> To be clear: I am using Eclipse 3.1 with PHPEclipse 1.1.8 and that is
> working very well. It does auto complete classes and functions written by
> my self etc.
>
> I tried some other PHP plugin for Eclipse, and that one behavied like you
> describe, therefore my change to SourceForge PHP Eclipse Plugin.
>
> Best regards,
> Peter Lauri
>
> www.dwsasia.com - company web site
> www.lauri.se - personal web site
> www.carbonfree.org.uk - become Carbon Free
>
>
>
> -----Original Message-----
> From: Larry Garfield [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 21, 2007 9:31 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] most powerful php editor
>
> That's interesting. I've been trying to use Eclipse, and its
> code-assistance
> for PHP is some of the worst I've ever used. I can't type "array" without
> it
> trying to complete that to an Array class from SPL, yet it never
> auto-completes to any function or class I wrote myself. Nor does it seem
> to
>
> pick up on anything BUT classes. It's terrible. How'd you get it to
> behave?
>
> On Sunday 21 January 2007 5:22 am, Peter Lauri wrote:
> > I would put my vote on Eclipse. It has great support for cvs and also for
> > general coding "autofilling" etc. The downside is that it is resource
> > demanding...
> >
> > Best regards,
> > Peter Lauri
> >
> > www.dwsasia.com - company web site
> > www.lauri.se - personal web site
> > www.carbonfree.org.uk - become Carbon Free
> >
> >
> > -----Original Message-----
> > From: Vinicius C Silva [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, January 21, 2007 2:54 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] most powerful php editor
> >
> > hi everyone!
> >
> > i'd like to ask something maybe commonly asked here. what is the most
> > powerful php editor?
>
> --
> Larry Garfield AIM: LOLG42
> [EMAIL PROTECTED] ICQ: 6817012
>
> "If nature has made any one thing less susceptible than all others of
> exclusive property, it is the action of the thinking power called an idea,
> which an individual may exclusively possess as long as he keeps it to
> himself; but the moment it is divulged, it forces itself into the
> possession
>
> of every one, and the receiver cannot dispossess himself of it." -- Thomas
> Jefferson
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: John Meyer [mailto:[EMAIL PROTECTED]
Sent: 22 January 2007 03:15
To: php-general@lists.php.net
Subject: Re: [PHP] most powerful php editor
Dear god Arnot, would you like to stand back for a moment and consider
how retarded those statements are, or would you like for me to do it for
you?
Whether you use a powerful IDE or not, you still have to use the same
compiler underneath. In PHP, that "compiler" is the web server. Unless
you buy an IDE that contains a mini-server for you to test the files,
yoru comparison between IDEs and word processors is ludicrous at best.
======================================
That's the point I was trying to make, but obviously not very well.
A good PHP IDE does have a built-in web server. It can do profiling,
debugging, error high-lighting, project level function cross-checking,
scope-checking, defines checking, version control, internal ftp, db
front-end, and a whole truckload of other features that help you manage
large projects. Sure it's not going to turn a monkey into a coding guru, but
it's sure going to help anyone trying to manage large complex environments.
I had the fortune to work with a brilliant IBM IDE years ago when I was
working in C, and I discovered how much more you can get done (code and
complexity) when you use the right tools. When I moved to PHP I struggled
for the first while working on a project with more than a hundred files and
more than a hundred db tables, using a bunch of unintegrated tools to get
the job done. I could make it work but it was a laborious process of
cross-checking every step of the way. And the biggest problem was no
debugger. Now with a real IDE I can work between 4 and 10 times as fast, and
tackle bigger projects and far more complex stuff. But as Robert said, to
each their own.
BTW I did once have the misfortune of having to prepare about 100 documents
for ECITE back in 2002, each doc about 20-50 pages. Between projects and
short of cash. I'm no document formatter - I far prefer coding for 18 hrs a
day than spending 18 hrs a day formatting documents, no matter how good the
word processor. I believe there are people who lap this kind of stuff up,
but I'm not one of them. I got the job done but would never do it again. A
good example where the right tools can't turn a monkey into a pro. But my
point is that not even the pro's could do it properly without the right
tools.
Arno
--- End Message ---
--- Begin Message ---
Hi List
I am working with an application that has to run as a socket listener. It
receives a string from another application on a certain socket and then does
some processing and then passes the result back to the client application via
the socket. Here is the listener code I am using
while(true)
{
$client = socket_accept($socket);
$arev_data = socket_read($client, 1024);
$yresponse = build_XML_request($arev_data);
socket_write($client, $yresponse);
socket_close($client);
}
socket_close($socket);
The application is working fine but I have just noticed that when the $yresponse
variable is larger than 1024 bytes the string returned to the client is
truncated. I just had a look at the php manual for socket_write and it
mentions that truncating the data at the buffer size can be a problem. The
manual does not offer any possible solutions though. I am stumped here as the
value for $yresponse will often be larger than 1024 bytes and its length is
quite variable.
Does anyone have any suggestions on how I can make sure the entire contents of
$yresponse are passed back to the client?
Regards,
Richard Luckhurst
Product Development
Exodus Systems - Sydney, Australia.
--- End Message ---
--- Begin Message ---
Richard Luckhurst wrote:
> Hi List
>
> I am working with an application that has to run as a socket listener. It
> receives a string from another application on a certain socket and then does
> some processing and then passes the result back to the client application via
> the socket. Here is the listener code I am using
>
> while(true)
> {
> $client = socket_accept($socket);
>
> $arev_data = socket_read($client, 1024);
>
> $yresponse = build_XML_request($arev_data);
>
> socket_write($client, $yresponse);
>
> socket_close($client);
>
> }
> socket_close($socket);
>
> The application is working fine but I have just noticed that when the
> $yresponse
> variable is larger than 1024 bytes the string returned to the client is
> truncated. I just had a look at the php manual for socket_write and it
> mentions that truncating the data at the buffer size can be a problem. The
> manual does not offer any possible solutions though. I am stumped here as the
> value for $yresponse will often be larger than 1024 bytes and its length is
> quite variable.
>
> Does anyone have any suggestions on how I can make sure the entire contents of
> $yresponse are passed back to the client?
I would start by reading the relevant page:
http://php.net/socket_write
after reading that your first attempt will probably be this
(you may have complication is your using a multibyte charset):
socket_write($client, $yresponse, strlen($yresponse));
if that doesn't work, you will be looking at capturing the return value
of socket_write() in order to determine how many bytes were sent ...
this information will allow to to use a loop to call socket_write as many times
as is required to send all the data. hope that makes sense to you.
>
>
>
>
> Regards,
> Richard Luckhurst
> Product Development
> Exodus Systems - Sydney, Australia.
>
--- End Message ---
--- Begin Message ---
Hi Jochem,
JM> I would start by reading the relevant page:
JM> http://php.net/socket_write
JM> after reading that your first attempt will probably be this
JM> (you may have complication is your using a multibyte charset):
As I had said in my earlier post I had already read the php manual section for
socket_write.
JM> socket_write($client, $yresponse, strlen($yresponse));
JM> if that doesn't work, you will be looking at capturing the return value
JM> of socket_write() in order to determine how many bytes were sent ...
JM> this information will allow to to use a loop to call socket_write as many
times
JM> as is required to send all the data. hope that makes sense to you.
I tried the strlen($yresponse) length option in socket_write and it did not
matter if I set socket_write to anything larger than 1024. It appears that there
is a buffer with a size of 1024 and in my case the length option would only be
of use if the string I wanted to send was shorter than the size of the buffer.
Rather than capturing the return value of socket_write I broke my test string
into 2 chunks as the total was less than 2048 bytes.
What I tried was
// grab first 1024 bytes
$buffer = substr($yresponse,0,1024);
// send first 1024 bytes
socket_write($client, $buffer);
// replace first 1024 bytes with ''
$buffer = substr_replace($yresponse,'',0,1024);
//send the remainder of the string
socket_write ($client, $buffer);
What I found was that the first 1024 bytes was sent but I still never saw the
second 1024 bytes. It seem the second socket_write is not happening.
Am I on the right track here?
>>
>>
>>
>>
>> Regards,
>> Richard Luckhurst
>> Product Development
>> Exodus Systems - Sydney, Australia.
>>
--- End Message ---
--- Begin Message ---
Hi Jochem,
JM> I would start by reading the relevant page:
JM> http://php.net/socket_write
JM> after reading that your first attempt will probably be this
JM> (you may have complication is your using a multibyte charset):
As I had said in my earlier post I had already read the php manual section for
socket_write.
JM> socket_write($client, $yresponse, strlen($yresponse));
JM> if that doesn't work, you will be looking at capturing the return value
JM> of socket_write() in order to determine how many bytes were sent ...
JM> this information will allow to to use a loop to call socket_write as many
times
JM> as is required to send all the data. hope that makes sense to you.
I tried the strlen($yresponse) length option in socket_write and it did not
matter if I set socket_write to anything larger than 1024. It appears that there
is a buffer with a size of 1024 and in my case the length option would only be
of use if the string I wanted to send was shorter than the size of the buffer.
Rather than capturing the return value of socket_write I broke my test string
into 2 chunks as the total was less than 2048 bytes.
What I tried was
// grab first 1024 bytes
$buffer = substr($yresponse,0,1024);
// send first 1024 bytes
socket_write($client, $buffer);
// replace first 1024 bytes with ''
$buffer = substr_replace($yresponse,'',0,1024);
//send the remainder of the string
socket_write ($client, $buffer);
What I found was that the first 1024 bytes was sent but I still never saw the
second 1024 bytes. It seem the second socket_write is not happening.
Am I on the right track here?
>>
>>
>>
>>
>> Regards,
>> Richard Luckhurst
>> Product Development
>> Exodus Systems - Sydney, Australia.
>>
--- End Message ---
--- Begin Message ---
Hi List
I have been banging my head against a wall all day trying to work this problem
out. To recap my earlier post, I have a simple socket listener that handles the
incoming string fine with socket_read and then it fires off the application as
it should. When it returns the data to the socket only the first 1024 bytes get
sent.
I have done some testing and for the life of me I can not find a way to loop
through the buffer. Everything I try still results in only the first 1024 bytes.
Here is the code I have been trying
while(true)
{
$client = socket_accept($socket);
$arev_data = socket_read($client, 1024);
$yresponse = build_XML_request($arev_data);
if (strlen ($yresponse) < 1024)
{
socket_write($client, $yresponse);
}
else
{
while (strlen($yresponse) > 0)
{
if (strlen ($yresponse) > 1024)
{
$out = substr($yresponse, 0, 1024);
socket_write($client, $out,
strlen($out));
$yresponse =
substr_replace($yresponse,'',0,1024);
}
else
{
socket_write($client, $yresponse);
print "$yresponse ";
$yresponse =
substr_replace($yresponse,'',0,strlen($yresponse));
}
}
}
socket_close($client);
}
Just for testing I cave an if statement that takes care of the case where there
is a data string of less than 1024 bytes. The problem starts when I get into the
else case where the$response is larger than 1024 bytes. The if statement seems
OK and the first time through when the test data is 1521 bytes the first 1024
bytes gets returned by the socket_write. I then get rid of the first 1024 bytes
of the string and the if statement falls through to the else as the string is
now only 497 bytes left in the $ypsilon string. I see nothing returned to the
client by the socket_write here however the print "$yresponse \n"; prints the
data. I can not work out why the socket_write is not writing the data to the
socket at this point.
Does anyone have any clues?
Regards,
Richard Luckhurst
Product Development
Exodus Systems - Sydney, Australia.
--- End Message ---
--- Begin Message ---
Richard Luckhurst wrote:
I have been banging my head against a wall all day trying to work
this problem out. To recap my earlier post, I have a simple socket
listener that handles the incoming string fine with socket_read and
then it fires off the application as it should. When it returns the
data to the socket only the first 1024 bytes get sent.
I have done some testing and for the life of me I can not find a way
to loop through the buffer. Everything I try still results in only
the first 1024 bytes.
<snipped a whole load of crap that nobody cares about>
Does anyone have any clues?
You've already been given a clue... read the manual:
http://php.net/socket_write
I know you said you read it, but you obviously haven't. To quote...
"Returns the number of bytes successfully written to the socket or
*FALSE* on error"
You are not even checking the return value from socket_write for an
error, nevermind to see the number of bytes actually sent. The
socket_write function, like many other similar functions, is not
guaranteed to send exactly what you give it, even if you provide the
third parameter.
Your code for sending data should be structured something like the
following *untested* code...
$len = strlen($datatosend);
$offset = strlen($datatosend);
while ($offset < $len)
{
$sent = socket_write($client, substr($datatosend, $offset), $len -
$offset);
if ($sent === false)
{
// An error occurred, break out of the while loop
break;
}
$offset += $sent;
}
if ($offset < $len)
{
// An error occurred, use *socket_last_error()*
<http://uk2.php.net/manual/en/function.socket-last-error.php>* and
**socket_strerror()*
<http://uk2.php.net/manual/en/function.socket-strerror.php> to find out
what happened
}
else
{
// Data sent ok
}
Your problem is that you made lazy assumptions, and we all know that
assumptions are the mother of all fsckups. Now please irradiate your
hands and try again.
-Stut
--- End Message ---
--- Begin Message ---
hi Richard,
Richard Luckhurst wrote:
> Hi List
>
....
> Does anyone have any clues?
sorry to assume you hadden not read the manual, but it does seem your
not taking onboard the bit about the return value of socket_write().
please revise you code in the manner Stut suggested (checking/using the return
value of scket_write()) and come back if that doesn't work.
>
> Regards,
> Richard Luckhurst
> Product Development
> Exodus Systems - Sydney, Australia.
>
--- End Message ---
--- Begin Message ---
Please keep it on-list, even if you feel you need to have a go at me -
they love it!
[EMAIL PROTECTED] wrote:
> You've already been given a clue... read the manual:
> http://php.net/socket_write
>
> I know you said you read it, but you obviously haven't. To quote...
Now you are making an assumption and you are making a "fsckup". Just
because I did not show in my simplified example that I had tested the
number of bytses sent does not mean for a second that I had not done
it.
I'm going by the information you have supplied. You cannot possibly
expect us to help you if you do not provide the correct information.
The number of bytes sent was 1024 for the first iteration of the loop
and none for the second. The socket_write function returned a status
of "SUCCESS".
Please show us the *actual* code you are using. Without that we don't
have any real chance of finding the problem.
> Your problem is that you made lazy assumptions, and we all know
> that assumptions are the mother of all fsckups. Now please
> irradiate your hands and try again.
I believe you are making an "lazy assumption" here as you have no
idea what I have tried. While I appreciate help I believe your
response was rude and not very helpful to a newbie to PHP.
I apologise if you took my response to be rude, that was not my intention.
As I said before, if you want help you need to give us accurate
information. We're not mind readers.
-Stut
PS. Look into my eyes, just the eyes, not around the eyes, into my eyes.
You're under. When you wake up you will realise that you were not
offended by my post, you were just embarrassed because you failed the
full disclosure test. 3..2..1.. and you're back.
--- End Message ---
--- Begin Message ---
2007/1/20, Arpad Ray <[EMAIL PROTECTED]>:
Martin Alterisio wrote:
> Double slash to prevent PHP interpreting the slashes. Also using single
> quotes would be a good idea:
>
> if (preg_match('/[\\w\\x2F]{6,}/',$a))
>
Just switching to single quotes would do the trick - you don't need to
escape anything but single quotes, and backslashes if they are the last
character.
Arpad
It's true, it works but I still believe is best to do both, since you may
forget to doubleslash when it's imperative for the expression to work, even
when using single quotes.
--- End Message ---