php-general Digest 25 Aug 2007 13:38:38 -0000 Issue 4981

Topics (messages 261259 through 261264):

Re: SQL Distinct-like behaviour
        261259 by: Hamza Saglam

Re: PHP4 vs PHP5 Performance?
        261260 by: Larry Garfield
        261261 by: Robert Cummings
        261264 by: Nathan Nobbe

Re: nuSoap client SOAP Call problem
        261262 by: Angelo Zanetti
        261263 by: Angelo Zanetti

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I don't know what I was thinking when I wrote that actually, that is so 
blatantly obvious :)


Thanks Brian.

Hamza.


"brian" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Marcelo de Moraes Serpa wrote:
>> How could I iterate over the files in a directory and build a list of 
>> unique
>> filenames? Take the following filelist:
>>
>> file1_01.jpg
>> file2_01.jpg
>> file2_02.jpg
>> file2_03.jpg
>> file3_01.jpg
>> file3_02.jpg
>> file3_03.jpg
>> file4_01.jpg
>> file4_02.jpg
>> file4_03.jpg
>>
>> I would like to build an array like this: $names =
>> ("file1","file2","file3","file4")
>>
>
> As mentioned, use array_unique(). But that'll only help once you've built 
> up an array of filenames (after trimming off the last bit). I think Jay & 
> Hamza missed the fact that the files are *already unique*. One would be 
> hard-pressed to store multiple files with the same name in a directory.
>
> So, i'm assuming your filenames wil be more like:
>
> foo_01.jpg
> foo_02.jpg
> bar_01.jpg
>
> etc. IOW, you want to perform a regexp such that you isolate the last part 
> to remove it before shuffling out the dupes. So:
>
> $filenames = Array('foo_01.jpg', 'foo_02.jpg', 'bar_01.jpg', 'baz_01.jpg', 
> 'bar_02.jpg');
>
> $out = array_unique(preg_replace('/^([a-z]+)_[0-9]+\.jpg$/', '$1', 
> $filenames));
>
> var_dump($out);
>
> --snip--
> array(3) {
>   [0]=>  string(3) "foo"
>   [2]=>  string(3) "bar"
>   [3]=>  string(3) "baz"
> }
> --snip--
>
> Note that if you might have uppercase letters, dashes, underscores, etc. 
> in the filename you'll need to modify that a bit. Something like:
>
> '/^([a-zA-Z-_]+)_[0-9]+\.jpg$/'
>
> If you'll have more than one file extension, replace 'jpg' with '[a-z]+'
>
> However, the array_unique call will cause, eg. both 'bar_01.jpg' and 
> 'bar_01.png' to output 'bar' only once, which may not be what you want.
>
> HTH,
> brian 

--- End Message ---
--- Begin Message ---
On Friday 24 August 2007, Lester Caine wrote:
> > What would be interesting is if a group picked up PHP4 and kept going
> > with it in spite of the end of life announcement a few weeks back.  I
> > wonder if the PHP license would allow such a thing.  How open is it
> > exactly?
>
> The PROBLEM is that supporting PHP4, 5 and now 6 is detracting from solving
> some of these problems. Until we can get away from HAVING to support PHP4,
> then PHP5 will not get the full fine tuning it needs. Proposing to maintain
> a branch of PHP4 will then result n people expecting all of the major
> frameworks to work on it - and WE need to be able to concentrate on USING
> PHP5 properly rather than having to bodge things still to be backwards
> compatible with PHP4 :(

The "major frameworks" have already agreed that PHP 4 is dead, even before the 
PHP dev team did.

http://gophp5.org/

Anyone expecting anything but a custom in-house application to continue to 
work in PHP 4 by next year is simply not paying attention.  Let it rest in 
peace.

-- 
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 ---
On Sat, 2007-08-25 at 00:28 -0500, Larry Garfield wrote:
> On Friday 24 August 2007, Lester Caine wrote:
> > > What would be interesting is if a group picked up PHP4 and kept going
> > > with it in spite of the end of life announcement a few weeks back.  I
> > > wonder if the PHP license would allow such a thing.  How open is it
> > > exactly?
> >
> > The PROBLEM is that supporting PHP4, 5 and now 6 is detracting from solving
> > some of these problems. Until we can get away from HAVING to support PHP4,
> > then PHP5 will not get the full fine tuning it needs. Proposing to maintain
> > a branch of PHP4 will then result n people expecting all of the major
> > frameworks to work on it - and WE need to be able to concentrate on USING
> > PHP5 properly rather than having to bodge things still to be backwards
> > compatible with PHP4 :(
> 
> The "major frameworks" have already agreed that PHP 4 is dead, even before 
> the 
> PHP dev team did.
> 
> http://gophp5.org/

*yawn*

> Anyone expecting anything but a custom in-house application to continue to 
> work in PHP 4 by next year is simply not paying attention.  Let it rest in 
> peace.

I think many applications will continue to work in PHP4 regardless of
the gophp5 project. It's not very hard to make applications work in both
PHP4 and PHP5. I would argue that only an idiot needlessly cuts off more
than half of their clientele. Elimination of PHP4 updates doesn't mean
suddenly 100% of the PHP install base becomes PHP5.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
i dont know Robert; i think it depends upon the structure of ones business.
for instance; i work for a company full time, and have a start up of my own.
in both of those situations there is no impact on the client in the act of
eliminating php4 from the product implementation.  the clients never use the
code directly.  perhaps you are in some different business??

also, there are many, many enhancements to php5 that php4 does not have.
most notably the oop facilities.  but also, exception handling; re-written
XML
infrastructure (SimpleXML, DOM) and a host of new functions not found in 4.
also, the __autoload feature, and even external tools such as SPL make php5
far superior to php4, imho :)

if its a little slower, i dont really care; ill be using optimization
techniques and
have them mastered w/in the next few months so any innate speed difference
will become negligible in my projects.

i probly shouldnt use the word idiot and php4 in conjunction, to reflect my
feelings
because i might actaullly offend some people on the list :)

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 00:28 -0500, Larry Garfield wrote:
> > On Friday 24 August 2007, Lester Caine wrote:
> > > > What would be interesting is if a group picked up PHP4 and kept
> going
> > > > with it in spite of the end of life announcement a few weeks
> back.  I
> > > > wonder if the PHP license would allow such a thing.  How open is it
> > > > exactly?
> > >
> > > The PROBLEM is that supporting PHP4, 5 and now 6 is detracting from
> solving
> > > some of these problems. Until we can get away from HAVING to support
> PHP4,
> > > then PHP5 will not get the full fine tuning it needs. Proposing to
> maintain
> > > a branch of PHP4 will then result n people expecting all of the major
> > > frameworks to work on it - and WE need to be able to concentrate on
> USING
> > > PHP5 properly rather than having to bodge things still to be backwards
> > > compatible with PHP4 :(
> >
> > The "major frameworks" have already agreed that PHP 4 is dead, even
> before the
> > PHP dev team did.
> >
> > http://gophp5.org/
>
> *yawn*
>
> > Anyone expecting anything but a custom in-house application to continue
> to
> > work in PHP 4 by next year is simply not paying attention.  Let it rest
> in
> > peace.
>
> I think many applications will continue to work in PHP4 regardless of
> the gophp5 project. It's not very hard to make applications work in both
> PHP4 and PHP5. I would argue that only an idiot needlessly cuts off more
> than half of their clientele. Elimination of PHP4 updates doesn't mean
> suddenly 100% of the PHP install base becomes PHP5.
>
> Cheers,
> Rob.
> --
> ...........................................................
> SwarmBuy.com - http://www.swarmbuy.com
>
>     Leveraging the buying power of the masses!
> ...........................................................
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---


Thijs Lensselink wrote:
On Fri, 24 Aug 2007 13:55:29 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
Thijs Lensselink wrote:
On Fri, 24 Aug 2007 12:39:06 +0200, Angelo Zanetti <[EMAIL PROTECTED]>
wrote:
Thijs Lensselink wrote:

On Fri, 24 Aug 2007 11:53:12 +0200, Angelo Zanetti
<[EMAIL PROTECTED]>
wrote:

It's probably better to ask on a NuSOAP list.

The call method needs an array with parameters as far as i remember.
But i never use the call method anyway. I always go for the send

method.

First create your request XML.

$request = '<SubscriptionStatus xmlns='http://localhost/'>
        <ISPID>xx</ISPID>
        <ISPPassword>yy</ISPPassword>
        <ISPUserID>Angelo1</ISPUserID>
</SubscriptionStatus>';

Then serialize the envelope so it looks like a SOAP request.

$msg = $client->serializeEnvelope($request, false, false,
'document',
'literal');


And use the send method to make a connection and send the request.

$action = 'location of the webservice';



The action variable is that the URL of the WSDL?



$results = $client->send($msg, $action, 60, 60);



Why do you have 60 twice? As far as I can see in the API the send
document is only receiving 3 parameters?

I have posted to many SOAP forums and the mailing list. No luck what
so
ever. Your the first to reply thanks, I think this could work.

Your help is very much appreciated.

regards
Angelo


Hey Angelo,

I know getting info for NuSOAP is a b*tch. Maybe switch to PHP5 and
the
SOAP extension?

The $action variable is not the WSDL url. I missed that part in your

first post.

The $action var is actually build up from two parts. The first part

being the webservice

location. And the second part is /webserviceAction

The reason i have two 60's in the method call is because in the

soapclient

class the method looks like this:

function send($msg, $soapaction = '', $timeout=0,
$response_timeout=30)
{

But in the meantime i've been trying some other things with NuSOAP.
And
got this to work with WSDL.

$request = '<SubscriptionStatus xmlns='http://localhost/'>
        <ISPID>xx</ISPID>
        <ISPPassword>yy</ISPPassword>
        <ISPUserID>Angelo1</ISPUserID>
 </SubscriptionStatus>';

$params = array('request' => $request);

$operation = 'WebserviceAction';
$result = $client->call($operation, $params, $namespace);

Hope this helps.



Hi, yes I have done it as you have specified with the call method
unfortunately for some weird reason that creates the duplication.
However I have almost got your previous mail working. But in the XML
request I have:
Now I see this is present:  xmlns:0="" --> its an error thats making
the
XML invalid any reason why its making that?

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:si="http://soapinterop.org/xsd"; xmlns:0="">



Another thing i that I have made the action variable to :
"wsdlURL/SubscriptionStatus"  where wsdlURL is the URL of wsdl.
This also doesnt work but it might have to do with the above invalid
XML
so perhaps this is the correct way to create the action parameter?

Thanks again very much.

The empy xmlns means there is no namespace set.
I guess you didn't provide a namespace in the serializeEnvelope method.
The 3rd parameter is set to false in the example. But that's where you
should
set the $namspace.

The WSDL url should work if you take of the ?wsdl part.

Thanks again.
I have specified the namespace but the problem is that its creating the
weird characters:

xmlns:0=""

:0  Im not sure where they come from and I'm not sure I need the name
space anyway

Any idea why its causing this character?
thank



try this:
$msg = $client->serializeEnvelope($request, '', array(), 'document', 'literal');

That worked! I assume that it was send it as an array element therefore the 0 appeared causing the XML page to be invalid.

Thanks

--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message ---


Thijs Lensselink wrote:
Angelo Zanetti wrote:

Thijs Lensselink wrote:
On Fri, 24 Aug 2007 07:57:48 +0200, Angelo Zanetti
<[EMAIL PROTECTED]> wrote:
Dear all

Im using nusoap to create a cleint and I am having a small issue but
its a
fairly large one because I cant get the correct XML to send.

I have a scenario as follows:

My client:

$wsdlfile="http://xxxxxxxxxxx_WSDL.xml?wsdl";;
$client=new soapclient($wsdlfile, true); //, true);
$client->soap_defencoding = 'utf-8';

$nameSpace = "xxxxxxx";

Tried this:

          $parameters = "<SubscriptionStatus
xmlns='http://localhost/'>";
          $parameters .= "<ISPID>xx</ISPID>";
          $parameters .= "<ISPPassword>yy</ISPPassword>";
          $parameters .= "<ISPUserID>Angelo1</ISPUserID>";
          $parameters .= "</SubscriptionStatus>";

        $result = $client->call('SubscriptionStatus', $parameters,
$nameSpace);

To call the SubscriptionStatus process.


I have also tried:
        /*$Request = array(
                array(
                 'ISPID' => 'xx',
                 'ISPPassword' => 'yy',
                 'ISPUserID'=>'Angelo1')
        );


        $result = $client->call('SubscriptionStatus', $Response,
$nameSpace);


The request must look like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
<soap:Body>
  <SubscriptionStatus xmlns="http://localhost/";>
    <ISPID>xx</ISPID>
    <ISPPassword>yy</ISPPassword>
    <ISPUserID>Angelo1</ISPUserID>
  </SubscriptionStatus>
</soap:Body>
</soap:Envelope>


But in fact it looks like this:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:si="http://soapinterop.org/xsd";
xmlns:tns="http://devbit.openbit.com/SOS/";>
    <SOAP-ENV:Body>
        <SubscriptionStatus xmlns="http://...";>
        <SubscriptionStatus xmlns="http://..";>
            <ISPID>lighthouse</ISPID>
            <ISPPassword>***</ISPPassword>
            <ISPUserID>Angelo1</ISPUserID>
        </SubscriptionStatus>
        </SubscriptionStatus>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

as you can see the

<SubscriptionStatus xmlns="http://...";>

has been repeated. This is causing my problems. I am not sure what is
causing it? Does it have something to do with name spaces? OR the way
the client object is created?


This is a straight forward call but I have been searching through so
many posts and have not had any luck. Please any links or any ideas are
most welcome.

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
It's probably better to ask on a NuSOAP list.
The call method needs an array with parameters as far as i remember.
But i never use the call method anyway. I always go for the send method.

First create your request XML.

$request = '<SubscriptionStatus xmlns='http://localhost/'>
    <ISPID>xx</ISPID>
    <ISPPassword>yy</ISPPassword>
    <ISPUserID>Angelo1</ISPUserID>
</SubscriptionStatus>';

Then serialize the envelope so it looks like a SOAP request.

$msg = $client->serializeEnvelope($request, false, false, 'document',
'literal');

And use the send method to make a connection and send the request.

$action = 'location of the webservice';
$results = $client->send($msg, $action, 60, 60);

Seems to make the XML request correctly but now the response from the
server is the WSDL file? strange even though my request is correct.

Im not 100% sure about the $action parameter? What must be entered
here? Also mustn't I specify the Element that is being consumed in the
webservice IE: "SubscriptionStatus"?

THanks again

The action parameter is something like: http://domain.com/webservice
>From the WSDL file you can get the soapAction. This is where the
requests go.

I think you are sending the XML correctly. But to the wrong endpoint.
(https://netshop.openbit.com/SOS/SOSServlet)



Thanks once again. I think its working nicely but I don't get anything from my send command but I can see the response and its not the WSDL now but the response from the server.

Will have to check that its working 100% but is there any reason why there is no result from the send command?

$result = $client->send($msg, $wsdlfile, 60, 60);

thanks again
--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

--- End Message ---

Reply via email to