php-general Digest 3 Oct 2007 01:36:30 -0000 Issue 5051
Topics (messages 262637 through 262662):
Re: strpos error (I'm missing something obvious)
262637 by: Jay Blanchard
262639 by: Al
262643 by: Andrew Ballard
262644 by: Kevin Murphy
262645 by: Al
262646 by: Andrew Ballard
Re: an apology
262638 by: Robert Cummings
Question about ereg_replace and urlencode...
262640 by: Venkatesh M. S.
262641 by: Stut
262642 by: Venkatesh M. S.
The Context of 0
262647 by: Jay Blanchard
262650 by: Robert Cummings
262651 by: Carlton Whitehead
Good Regex for general text search
262648 by: Amos Vryhof
262662 by: Chris
Custom pipe script failure code
262649 by: Alan Fullmer
nusoap service + php5 soap client problems
262652 by: blackwater dev
262654 by: Nathan Nobbe
262655 by: blackwater dev
Re: languages and PHP
262653 by: tedd
How can i only fetch a (rss/atom) feed when it's changed?
262656 by: Mark
262657 by: mike
fopen function and charset
262658 by: Mauricio Muriel
262659 by: Jay Blanchard
Re: Beginner Tutorials for using CLASSES in PHP4
262660 by: Tony Marston
262661 by: Tony Marston
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 ---
[snip]
> !== FALSE is not good either, it is not a valid test
>
> strpos returns the numeric position of the first occurrence of needle
in
> the haystack string.
Except when needle doesn't occur in string, in which case
"If needle is not found, strpos() will return boolean FALSE."
Checking strpos($foo,$bar) !== False is exactly right; since 0 ==
False,
you want to use !==, not !=.
[/snip]
If the string is in the first position does it not return a zero?
$needle = "a";
$haystack = "abcdef";
echo strpos($haystack, $needle);
returns 0
0 is not equal to false. But you are correct, if the string is not found
it returns the Boolean false, I should have been clearer.
--- End Message ---
--- Begin Message ---
Frankly, I use preg_match() for this type of thing. It's simpler and foolproof.
The difference in speed is negligible.
<?php
// The "i" after the pattern delimiter '%' indicates a case-insensitive search
if (preg_match("%$site%i", $referer)) {
echo $referer;
} else {
echo "A match was not found.";
}
?>
Kevin Murphy wrote:
Overly simplified version of my code.
$site = "http://www.wnc.edu";
$referer = $_SERVER["HTTP_REFERER"];
echo $referer; // the output is correct at: http://www.wnc.edu/test/
if (strpos($referer,$site) === TRUE)
{
echo "yes";
}
Why doesn't it echo out "yes"? I know I am doing something stupid here,
but it doesn't seem to work .... :-)
--- End Message ---
--- Begin Message ---
I'd suggest the following *slight* enhancement to make sure that the
HTTP_REFERER actually *begins* with the site name, not simply contains
it.
// prevents visits from pages like
http://badsite.com/form.htm?http://www.wnc.edu
if (strpos($referer, $site) === 0)
{
echo 'yes';
}
(or, if you like the preg solution)
if (preg_match("%^$site%", $referer))
{
//....
}
However, I'd argue that the effectiveness of checking the referrer
itself could be considered "negligible", and hardly "foolproof". The
header is easily spoofed in scripts, and may not even be sent at all
by legitimate clients because of various browser and/or personal
firewall options.
Andrew
--- End Message ---
--- Begin Message ---
Thanks for the info. I've modified the script to reflect that. I
actually ended up reversing it, and so I used !== 0 which should work
just the same.
All this is a minor portion of a much larger security scheme for an
intranet site (which is protected by an LDAP server), where I am just
trying to keep images outside the web directory, and want to prevent
people from linking directly to an image... the only way an image
displays is if they view the page, and not link directly to the
image. Not foolproof, I know, but I'm not dealing with the general
population here, just internal employees some of whom are more
computer savvy than others.
Thanks all for your help. It seems to be working now.
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326
P.S. Please note that my e-mail and website address have changed from
wncc.edu to wnc.edu.
On Oct 2, 2007, at 8:32 AM, Andrew Ballard wrote:
I'd suggest the following *slight* enhancement to make sure that the
HTTP_REFERER actually *begins* with the site name, not simply contains
it.
// prevents visits from pages like
http://badsite.com/form.htm?http://www.wnc.edu
if (strpos($referer, $site) === 0)
{
echo 'yes';
}
(or, if you like the preg solution)
if (preg_match("%^$site%", $referer))
{
//....
}
However, I'd argue that the effectiveness of checking the referrer
itself could be considered "negligible", and hardly "foolproof". The
header is easily spoofed in scripts, and may not even be sent at all
by legitimate clients because of various browser and/or personal
firewall options.
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I didn't mean that the function was foolproof, only the match function itself.
However, your suggestion to add the line start is simple and effective.
Andrew Ballard wrote:
I'd suggest the following *slight* enhancement to make sure that the
HTTP_REFERER actually *begins* with the site name, not simply contains
it.
// prevents visits from pages like
http://badsite.com/form.htm?http://www.wnc.edu
if (strpos($referer, $site) === 0)
{
echo 'yes';
}
(or, if you like the preg solution)
if (preg_match("%^$site%", $referer))
{
//....
}
However, I'd argue that the effectiveness of checking the referrer
itself could be considered "negligible", and hardly "foolproof". The
header is easily spoofed in scripts, and may not even be sent at all
by legitimate clients because of various browser and/or personal
firewall options.
Andrew
--- End Message ---
--- Begin Message ---
On 10/2/07, Al <[EMAIL PROTECTED]> wrote:
> I didn't mean that the function was foolproof, only the match function itself.
Understood. :-)
--- End Message ---
--- Begin Message ---
On Tue, 2007-10-02 at 09:34 -0400, Daniel Brown wrote:
> On 10/1/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > ....Most of us have pretty thick skin around here.
>
> Yeah, especially Rob.
>
> Wait.... skin or skull? Ah, well.... ;-P
Duh... wha?! You make funny?
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
Hello!
i am trying to make links clickable on a page. I would like to
urlencode the URL so that it is well passed to a redirect.php file,
which would do somethings and then also do a meta http refresh
I am trying to use a function like the following, but it doesn't work.
I would like to apply urlencode on the link that is there in $str, so
that i have the link to redirect.php?url=<<urlencoded str>>
With the following, "1" gets hardcoded in my link! How do i urlencode it please?
Any thoughts would help
Regards
Venky
<?php
$str='blah blah
http://www.someserver.com/indexn12.asp?main_variable=EDITS&file_name=edit3%2Etxt&counter_img=3
blah blah';
function b_make_clickable ($str) {
$str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)',
'<a href="http://www.myserver.com/redirect.php?url=' . urlencode(1) .
'" target="_blank">\1</a>', $str);
$str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)',
'\1<a href="http://www.myserver.com/redirect.php?url=http://' .
urlencode(2) . '" target="_blank">\2</a>', $str);
$str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','<a
href="mailto:\1">\1</a>', $str);
return $str;
}
?>
--- End Message ---
--- Begin Message ---
Venkatesh M. S. wrote:
Hello!
i am trying to make links clickable on a page. I would like to
urlencode the URL so that it is well passed to a redirect.php file,
which would do somethings and then also do a meta http refresh
I am trying to use a function like the following, but it doesn't work.
I would like to apply urlencode on the link that is there in $str, so
that i have the link to redirect.php?url=<<urlencoded str>>
With the following, "1" gets hardcoded in my link! How do i urlencode it please?
Any thoughts would help
Regards
Venky
<?php
$str='blah blah
http://www.someserver.com/indexn12.asp?main_variable=EDITS&file_name=edit3%2Etxt&counter_img=3
blah blah';
function b_make_clickable ($str) {
$str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)',
'<a href="http://www.myserver.com/redirect.php?url=' . urlencode(1) .
'" target="_blank">\1</a>', $str);
$str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)',
'\1<a href="http://www.myserver.com/redirect.php?url=http://' .
urlencode(2) . '" target="_blank">\2</a>', $str);
$str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','<a
href="mailto:\1">\1</a>', $str);
return $str;
}
?>
That would be the bit where you use urlencode(1) to put the URL into the
URL. I think you want urlencode($str) instead.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Many thanks Stut
The problem is that the rest of the $str is actually a big post from a
blog, which will have many other text and info apart from the URL, and
i don't want to urlencode everything in there!
Venky
On 02/10/2007, Stut <[EMAIL PROTECTED]> wrote:
> Venkatesh M. S. wrote:
> > Hello!
> >
> > i am trying to make links clickable on a page. I would like to
> > urlencode the URL so that it is well passed to a redirect.php file,
> > which would do somethings and then also do a meta http refresh
> >
> > I am trying to use a function like the following, but it doesn't work.
> > I would like to apply urlencode on the link that is there in $str, so
> > that i have the link to redirect.php?url=<<urlencoded str>>
> >
> > With the following, "1" gets hardcoded in my link! How do i urlencode it
> > please?
> >
> > Any thoughts would help
> >
> > Regards
> >
> > Venky
> >
> > <?php
> >
> > $str='blah blah
> > http://www.someserver.com/indexn12.asp?main_variable=EDITS&file_name=edit3%2Etxt&counter_img=3
> > blah blah';
> >
> >
> > function b_make_clickable ($str) {
> > $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)',
> > '<a href="http://www.myserver.com/redirect.php?url=' . urlencode(1) .
> > '" target="_blank">\1</a>', $str);
> > $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)',
> > '\1<a href="http://www.myserver.com/redirect.php?url=http://' .
> > urlencode(2) . '" target="_blank">\2</a>', $str);
> > $str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','<a
> > href="mailto:\1">\1</a>', $str);
> > return $str;
> > }
> >
> > ?>
>
> That would be the bit where you use urlencode(1) to put the URL into the
> URL. I think you want urlencode($str) instead.
>
> -Stut
>
> --
> http://stut.net/
>
--- End Message ---
--- Begin Message ---
[small rant]
This morning's thread on strpos() brings up an interesting point, zero
has a context.
In certain cases 0 is the equivalent of FALSE and in other cases a 0 is
just a 0. In the context of strpos() 0 indicates that the needle is in
the first position of the haystack. If the needle is not found in the
haystack a Boolean FALSE is returned. In this case 0 is not the
equivalent of FALSE.
There are other cases, most of them specific to strings, in which 0 is
not the equivalent of FALSE. Newbies to PHP or certain functions will no
doubt encounter these cases at some point.
Exercise care when using 0 to determine if something is FALSE and
understand that 0 has context.
[/small rant]
--- End Message ---
--- Begin Message ---
On Tue, 2007-10-02 at 12:14 -0500, Jay Blanchard wrote:
> [small rant]
> This morning's thread on strpos() brings up an interesting point, zero
> has a context.
>
> In certain cases 0 is the equivalent of FALSE and in other cases a 0 is
> just a 0. In the context of strpos() 0 indicates that the needle is in
> the first position of the haystack. If the needle is not found in the
> haystack a Boolean FALSE is returned. In this case 0 is not the
> equivalent of FALSE.
>
> There are other cases, most of them specific to strings, in which 0 is
> not the equivalent of FALSE. Newbies to PHP or certain functions will no
> doubt encounter these cases at some point.
>
> Exercise care when using 0 to determine if something is FALSE and
> understand that 0 has context.
> [/small rant]
I don't know why this is a rant. In most languages 0 is equivalent to
false. Even in C when you:
#define FALSE 0
If you want to match false exactly then use the tools provided. Namely
the equality operator === and not the equivalence operator ==.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
This should be a lesson about how important it is to keep in mind the *type* of
data when writing comparisons, even in a dynamic/weakly-typed language like PHP.
For example, consider this test case:
<?php
if (0 == false) { echo 'PHP thinks the integer 0 is equal to boolean false,
even though they are a different type'; }
if (0 === false) { echo 'PHP thinks the integer 0 is equal to boolean false and
is of the same type'; }
?>
The == operator performs a very loose comparison of "equality" between the
supplied values, converting the types before performing the comparison. When
false is converted to an integer, it converts as 0, which happens to be the
same as 0, therefore the code block executes.
The === operator performs a stricter comparison of equality between the
supplied values, taking into account the type. Because an integer and a
boolean are being compared, it will always evaluate as false. The code in the
second if-statement will never be executed because of this.
Also keep in mind the != and !== operators differ from each other in much the
same way as == and === differ.
Refer to http://www.php.net/manual/en/language.operators.comparison.php for
more details about this.
Regards,
Carlton Whitehead
----- Original Message -----
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Tuesday, October 2, 2007 1:14:42 PM (GMT-0500) America/New_York
Subject: [PHP] The Context of 0
[small rant]
This morning's thread on strpos() brings up an interesting point, zero
has a context.
In certain cases 0 is the equivalent of FALSE and in other cases a 0 is
just a 0. In the context of strpos() 0 indicates that the needle is in
the first position of the haystack. If the needle is not found in the
haystack a Boolean FALSE is returned. In this case 0 is not the
equivalent of FALSE.
There are other cases, most of them specific to strings, in which 0 is
not the equivalent of FALSE. Newbies to PHP or certain functions will no
doubt encounter these cases at some point.
Exercise care when using 0 to determine if something is FALSE and
understand that 0 has context.
[/small rant]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm writing a few very simple search scripts.
One searches in a few columns of a CSV file, while another just searches
through a collection of file names.
Currently, I just have it stripping illegal characters from the "needle"
and "haystack" then doing a substring search
if (substr_count(...)>0) {
return formatted results....
}
What I'm looking to do is enhance my searches with preg_match. What I
want to do is take my needle and haystack with the illegal strings
stripped out, split it down to words, and search for the string, no
matter what is between the words.
ex: "the cat and the dog"
would also return
"the cat ran from the bull and dog"
I might learn Regular Expressions at some point in the future, but I
just haven't had time to yet... so what I need is just what I would use
to build my string pattern for preg_match... I'll figure out the rest
and change my scripts appropriately.
Thanks in Advance!
--- End Message ---
--- Begin Message ---
Amos Vryhof wrote:
I'm writing a few very simple search scripts.
One searches in a few columns of a CSV file, while another just searches
through a collection of file names.
Currently, I just have it stripping illegal characters from the "needle"
and "haystack" then doing a substring search
if (substr_count(...)>0) {
return formatted results....
}
What I'm looking to do is enhance my searches with preg_match. What I
want to do is take my needle and haystack with the illegal strings
stripped out, split it down to words, and search for the string, no
matter what is between the words.
ex: "the cat and the dog"
would also return
"the cat ran from the bull and dog"
I might learn Regular Expressions at some point in the future, but I
just haven't had time to yet... so what I need is just what I would use
to build my string pattern for preg_match... I'll figure out the rest
and change my scripts appropriately.
You're not going to be able to do that with a regular expression because
the order of the words isn't even the same.
Why would you need to do this with a regex instead of the way it's
working right now?
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Hello,
I have a quick question regarding the pipe function in Postfix and the
use of PHP as a mail sorter/parser. I've looked around and see many
people have used PHP as a quick and dirty solution for putting mail data
into a database.
I am taking all incoming mail, parsing out headers and putting the mail
into a MySQL database. The problem I have is, if the script cannot
connect to the database, the script fails. What I want is to have this
message return back into the normal mail queue with a temporary failure
or something so it can retry at a later time without disappearing into
never never land. The reason for this, is if there is a connection
failure, or the database stops for some reason, I don't want these
messages to be lost due to a script failure.
Here is my pipe command:
spamfilter unix - n n - - pipe
flags=DRq user=spamfilter argv=/scripts/spamfilter.sh -f ${sender} --
${recipient}
Here is my spamfilter.sh command:
#!/bin/bash
/usr/bin/spamc -f -u "$4" | /scripts/parsemessage.php "$4"
exit $?
So is there a way to exit(); with some sort of code to put that message
back into the queue? I have read that I need to exit(75); but that does
not work. If anyone could help, that would be more than fantastic.
Thanks,
Alan
--- End Message ---
--- Begin Message ---
Hello,
I have this nusoap service:
$server= new soap_server();
$server->register('authenticate_user', array(), array());
// Initialize WSDL support
$server->configureWSDL('authenticate', 'urn:authenticate');
// Register the method to expose
$server->register('authenticate_user', // method name
array('key' => 'xsd:string','params'=>'xsd:array'), // input parameters
array('return' => 'xsd:array'), // output parameters
'urn:authenticate', // namespace
'urn:authenticate#authenticate_user', // soapaction
'rpc', // style
'encoded', // use
'Authenticates User' // documentation
);
function authenticate_user($key=null,$params=null){
$data['message']=true;
$data['key']=$key;
$data['params']=$params;
return $data;
}
/* "start" the service */
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
I then have a php5 box calling the service:
$client = new SoapClient("http://mysite.com/authenticate.php?wsdl");
$return=$client->authenticate_user("fdsfds",array("username"=>"mynameis","password"=>"fred"));
Problem is, it throws an error of:
*Fatal error*: Uncaught SoapFault exception: [HTTP] Unable to parse URL in
/var/www/mysite/html/webservices/test_authenticate_service.php:9 Stack
trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...',
'http:///~me...', 'urn:authenticat...', 1, 0) #1 [internal function]:
SoapClient->__call('authenticate_us...', Array) #2
/var/www/mysite/html/webservices/test_authenticate_service.php(9):
SoapClient->authenticate_user('fdsfds', Array) #3 {main} thrown in *
/var/www/mysite/html/webservices/test_authenticate_service.php* on line *9
How can I fix this?
Thanks!
*
--- End Message ---
--- Begin Message ---
this doesnt look like a wsdl file to me
http://mysite.com/authenticate.php?wsdl
-nathan
On 10/2/07, blackwater dev <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I have this nusoap service:
>
> $server= new soap_server();
> $server->register('authenticate_user', array(), array());
>
> // Initialize WSDL support
> $server->configureWSDL('authenticate', 'urn:authenticate');
> // Register the method to expose
> $server->register('authenticate_user', // method name
> array('key' => 'xsd:string','params'=>'xsd:array'), // input
> parameters
> array('return' => 'xsd:array'), // output
> parameters
> 'urn:authenticate', // namespace
> 'urn:authenticate#authenticate_user', // soapaction
> 'rpc', // style
> 'encoded', // use
> 'Authenticates User' // documentation
> );
>
> function authenticate_user($key=null,$params=null){
> $data['message']=true;
> $data['key']=$key;
> $data['params']=$params;
> return $data;
> }
>
> /* "start" the service */
> $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :
> '';
> $server->service($HTTP_RAW_POST_DATA);
>
>
> I then have a php5 box calling the service:
>
>
> $client = new SoapClient("http://mysite.com/authenticate.php?wsdl");
>
> $return=$client->authenticate_user("fdsfds",array("username"=>"mynameis","password"=>"fred"));
>
> Problem is, it throws an error of:
>
> *Fatal error*: Uncaught SoapFault exception: [HTTP] Unable to parse URL in
> /var/www/mysite/html/webservices/test_authenticate_service.php:9 Stack
> trace: #0 [internal function]: SoapClient->__doRequest('<?xml
> version="...',
> 'http:///~me...', 'urn:authenticat...', 1, 0) #1 [internal function]:
> SoapClient->__call('authenticate_us...', Array) #2
> /var/www/mysite/html/webservices/test_authenticate_service.php(9):
> SoapClient->authenticate_user('fdsfds', Array) #3 {main} thrown in *
> /var/www/mysite/html/webservices/test_authenticate_service.php* on line *9
>
> How can I fix this?
>
> Thanks!
> *
>
--- End Message ---
--- Begin Message ---
Yeah, because that was just changed so I could post it here:
Here is the actual wsdl:
<definitions targetNamespace="urn:authenticate">
−
<types>
−
<xsd:schema targetNamespace="urn:authenticate">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
−
<message name="authenticate_userRequest">
<part name="key" type="xsd:string"/>
<part name="params" type="xsd:string"/>
</message>
−
<message name="authenticate_userResponse">
<part name="return" type="xsd:array"/>
</message>
−
<portType name="authenticatePortType">
−
<operation name="authenticate_user">
<documentation>Authenticates Getloaded User</documentation>
<input message="tns:authenticate_userRequest"/>
<output message="tns:authenticate_userResponse"/>
</operation>
</portType>
−
<binding name="authenticateBinding" type="tns:authenticatePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="authenticate_user">
<soap:operation soapAction="urn:authenticate#authenticate_user"
style="rpc"/>
−
<input>
<soap:body use="encoded" namespace="urn:authenticate" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body use="encoded" namespace="urn:authenticate" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
−
<service name="authenticate">
−
<port name="authenticatePort" binding="tns:authenticateBinding">
<soap:address
location="http:///~jack/development/webservices/authenticate.gl"/>
</port>
</service>
</definitions>
On 10/2/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> this doesnt look like a wsdl file to me
> http://mysite.com/authenticate.php?wsdl
>
> -nathan
>
> On 10/2/07, blackwater dev <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> >
> > I have this nusoap service:
> >
> > $server= new soap_server();
> > $server->register('authenticate_user', array(), array());
> >
> > // Initialize WSDL support
> > $server->configureWSDL('authenticate', 'urn:authenticate');
> > // Register the method to expose
> > $server->register('authenticate_user', // method name
> > array('key' => 'xsd:string','params'=>'xsd:array'), // input
> > parameters
> > array('return' => 'xsd:array'), // output
> > parameters
> > 'urn:authenticate', // namespace
> > 'urn:authenticate#authenticate_user', // soapaction
> > 'rpc', // style
> > 'encoded', // use
> > 'Authenticates User' // documentation
> > );
> >
> > function authenticate_user($key=null,$params=null){
> > $data['message']=true;
> > $data['key']=$key;
> > $data['params']=$params;
> > return $data;
> > }
> >
> > /* "start" the service */
> > $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :
> > '';
> > $server->service($HTTP_RAW_POST_DATA);
> >
> >
> > I then have a php5 box calling the service:
> >
> >
> > $client = new SoapClient(" http://mysite.com/authenticate.php?wsdl");
> > $return=$client->authenticate_user("fdsfds",array("username"=>"mynameis","password"=>"fred"));
> >
> >
> > Problem is, it throws an error of:
> >
> > *Fatal error*: Uncaught SoapFault exception: [HTTP] Unable to parse URL
> > in
> > /var/www/mysite/html/webservices/test_authenticate_service.php:9 Stack
> > trace: #0 [internal function]: SoapClient->__doRequest('<?xml
> > version="...',
> > 'http:///~me...', 'urn:authenticat...', 1, 0) #1 [internal function]:
> > SoapClient->__call('authenticate_us...', Array) #2
> > /var/www/mysite/html/webservices/test_authenticate_service.php(9):
> > SoapClient->authenticate_user('fdsfds', Array) #3 {main} thrown in *
> > /var/www/mysite/html/webservices/test_authenticate_service.php* on line
> > *9
> >
> > How can I fix this?
> >
> > Thanks!
> > *
> >
>
>
--- End Message ---
--- Begin Message ---
At 11:09 AM +0100 10/2/07, Colin Guthrie wrote:
tedd wrote:
Isn't UTF-8 the big fish here?
Sure there' UTF-16 and larger, but everything else is a subset of UTF-8,
is it not?
So, what's the problem if you get a character defined by ISO -- it's
still within the UTF-8 super-group, right?
Individual characters are sometimes OK, but it's the sequence of
characters that could be invalid.
UTF-8 works by using special bits at the MSB end of the byte to say, "I
can't represent this character in one byte, I need to use 2 bytes (or 3
bytes)" (and maybe also 4? can't remember of the top of my head).
In a multi-byte sequence the MSB end of all the bytes must follow a
pre-defined scheme. If they do not they are syntactically invalid UTF-8.
So it's more than just individual characters, the order of them is
important.
Hope that explains it (although probably a bad explanation as I'm very
tired right now!).
Col
Ah, I see what you're saying. I've run into that before when studying
Unicode. The mb_ series of functions deal with larger than ASCII
coding, but I don't know of any that deals with character
sequence/combinations or right/left readings. That's all Greek to me,
pardon the pun.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hey,
I'm currently fetching feeds about every hour (automatically in php)
but sometimes there are no new updates in a feed for 2 hours. so no i
wonder if it's possible to check the feed somehow to see if it changed
since i last fetched it and if it's the case than download it like it
should.. if it's not changed than just skip the download.
Is this possible and how (with filemtime?)? i rather have a method
that works in php 4 and 5 (i use php 5 but alot of hosts still don't).
thanx,
Mark.
--- End Message ---
--- Begin Message ---
On 10/2/07, Mark <[EMAIL PROTECTED]> wrote:
> I'm currently fetching feeds about every hour (automatically in php)
> but sometimes there are no new updates in a feed for 2 hours. so no i
> wonder if it's possible to check the feed somehow to see if it changed
> since i last fetched it and if it's the case than download it like it
> should.. if it's not changed than just skip the download.
>
> Is this possible and how (with filemtime?)? i rather have a method
> that works in php 4 and 5 (i use php 5 but alot of hosts still don't).
[proper] feeds are generated in real-time. it depends if the server
sends along some sort of etag or other modification information, but i
would say the nature of RSS is to be dynamic and always up to date.
you should just work on something on your end to dupe check/detect new
items. that will be a much more consistent solution anyway, since it
will work on ANY feed. much better than relying on the server or the
other person's code or RSS code generator to tell the right last
modification time.
--- End Message ---
--- Begin Message ---
Hi.
I want to know, what charset is applied to every file when is created with
the fopen function and how can I to manage the charset when I use the fopen
function?
For example: If i want to create an ISO-8859-2 file, how can I to force, the
fopen function to create it?
Regards
--
Mauricio Muriel
[EMAIL PROTECTED]
Cel 1: +57 300 784-0345
Cel 2: +57 311 733-0934
SIBA S.A.
Calle 81 No.8-39 Ofc. 703
Bogotá, Colombia
Tel: +57 (1) 211-1934
http://www.siba.com.co
--- End Message ---
--- Begin Message ---
[snip]
I want to know, what charset is applied to every file when is created
with
the fopen function and how can I to manage the charset when I use the
fopen
function?
For example: If i want to create an ISO-8859-2 file, how can I to force,
the
fopen function to create it?
[/snip]
This may start to shed some light http://us2.php.net/mbstring
--- End Message ---
--- Begin Message ---
There's a small sample application that demonstrates how to use classes with
PHP 4 at http://www.tonymarston.net/php-mysql/sample-application.html
It also has a bigger framework at http://www.radicore.org/
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
"Jeff Cohan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yes, I know how to Google, and I've been Googling...
>
> But I would appreciate advice about good beginner tutorials using
> classes in PHP4 based on your actual experiences. I.e., have some of
> you found tutorials that really unlocked the doors for you?
>
> Ideally, such tutorials would have somewhat realistic examples. (I
> already know how to output "Hello, World" using a class, and I tend
> to find examples like those unhelpful. Maybe it's just me.)
>
> My main challenge is modularizing yer basic BREAD/CRUD operations
> with MySQL databases.
>
> I've made some strides in creating increasingly modular functions to
> present browse lists, edit forms and add forms; to perform
> field-level and form-level validations; and to perform inserts,
> updates and deletes. My approach is to utilize multidimensional
> arrays which define the column names, column labels (for forms),
> form control types (input, select, checkbox, etc.) and other
> attributes of the form controls. I've got a "library" of validation
> routines with error messages that appear on the form under the
> culprit form control.
>
> But I think taking the next step to use classes is going to make my
> life much easier.
>
> TIA for any guidance you might be able to offer.
>
> Jeff
--- End Message ---
--- Begin Message ---
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> although some people believe differently than i; i would argue
> trying to learn how to design w/ the classes that php4 provides
> is a waste of time.
I disagree. PHP 4 gives you access to classes, encapsulation, inheriance and
polymorphism. This is all you need for OO programming. All that extra crap
in PHP 5 is just window dressing.
> most books you will find regarding object oriented
> design assume the language has the basic constructs. ppp mainly.
> also, there are other important facilities php4 lacks like abstract
> classes
You can write abstact classses in PHP 4, it's just that you can't use the
word "abstract". Interfaces are totally irrelevant as any method can be
accessed directly through its function definition.
> and interfaces, not to mention you have to explicitly assign objects by
> reference in php4. (if you dont want a copy created).
> unless you are bound to php4 by work or something
> i suggest you start working w/ php5. also, if your looking for some
> design
> techniques i recommend studying design patterns.
Design patterns are overrated. For building transactions in CRUD
applications you need transaction patterns.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
> the heads first book
> is a great starting point.
> actually if you want a solid reference thats free on the web look at
> phpPatterns <http://www.phppatterns.com/docs/start>
> the code is mostly php4 i believe.
>
> -nathan
>
>
> On 9/29/07, Jeff Cohan <[EMAIL PROTECTED]> wrote:
>>
>> Yes, I know how to Google, and I've been Googling...
>>
>> But I would appreciate advice about good beginner tutorials using
>> classes in PHP4 based on your actual experiences. I.e., have some of
>> you found tutorials that really unlocked the doors for you?
>>
>> Ideally, such tutorials would have somewhat realistic examples. (I
>> already know how to output "Hello, World" using a class, and I tend
>> to find examples like those unhelpful. Maybe it's just me.)
>>
>> My main challenge is modularizing yer basic BREAD/CRUD operations
>> with MySQL databases.
>>
>> I've made some strides in creating increasingly modular functions to
>> present browse lists, edit forms and add forms; to perform
>> field-level and form-level validations; and to perform inserts,
>> updates and deletes. My approach is to utilize multidimensional
>> arrays which define the column names, column labels (for forms),
>> form control types (input, select, checkbox, etc.) and other
>> attributes of the form controls. I've got a "library" of validation
>> routines with error messages that appear on the form under the
>> culprit form control.
>>
>> But I think taking the next step to use classes is going to make my
>> life much easier.
>>
>> TIA for any guidance you might be able to offer.
>>
>> Jeff
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--- End Message ---