php-general Digest 21 Sep 2009 10:08:57 -0000 Issue 6350

2009-09-21 Thread php-general-digest-help

php-general Digest 21 Sep 2009 10:08:57 - Issue 6350

Topics (messages 298206 through 298221):

Re: Creating file name with $variable
298206 by: Ralph Deffke
298208 by: Tommy Pham
298216 by: Lars Torben Wilson

more info. help?
298207 by: johny why

Is an E_STRICT warning when overwriting a static method with a different 
parameter list desired?
298209 by: Martijn Evers

Usage of strlen(tuf8_decode()) and /u regex modifier
298210 by: GoForThisWorld

Best Practice to Create Dynamic URL's- With Username
298211 by: Gaurav Kumar
298212 by: Ashley Sheridan
298213 by: Tommy Pham
298214 by: Ralph Deffke
298215 by: Richard Heyes
298217 by: Gaurav Kumar
298218 by: Andrea Giammarchi
298219 by: Gaurav Kumar
298220 by: Ashley Sheridan
298221 by: Gaurav Kumar

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Hi Haig,

it would be better if u tell us what purpose u want to solf with this
approuch. Its hard to understand for a prov why u want to create a filename
.php
.php files are scrips containing functions or classes, called/instantinated
with parameters.
why the hell u want to create a filename with these parameters? does this
file excist?
you can create 'dynamic code' in php, but u would never write it to a file!

understand that that question is wierd and appears that ur concept is wild
and realy sick.

ralph_def...@yahoo.de

Haig Davis level...@gmail.com wrote in message
news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
 Good Afternoon All,

 Thanks for the help with the checkbox issue the other day.

 Todays question: I want to create a filename.php from a variable more
 specifically the results if a mySQL query I.e. userID + orderNumber =
 filename. Is this possible? 'cause I've tried every option I can think
 of and am not winng.

 Thanks a ton

 Haig

 Sent from my iPhone


---End Message---
---BeginMessage---
- Original Message 
 From: Ralph Deffke ralph_def...@yahoo.de
 To: php-gene...@lists.php.net
 Sent: Sunday, September 20, 2009 3:43:24 PM
 Subject: [PHP] Re: Creating file name with $variable
 
 Hi Haig,
 
 it would be better if u tell us what purpose u want to solf with this
 approuch. Its hard to understand for a prov why u want to create a filename
 .php
 .php files are scrips containing functions or classes, called/instantinated
 with parameters.
 why the hell u want to create a filename with these parameters? does this
 file excist?
 you can create 'dynamic code' in php, but u would never write it to a file!
 
 understand that that question is wierd and appears that ur concept is wild
 and realy sick.
 
 ralph_def...@yahoo.de
 
 Haig Davis wrote in message
 news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
  Good Afternoon All,
 
  Thanks for the help with the checkbox issue the other day.
 
  Todays question: I want to create a filename.php from a variable more
  specifically the results if a mySQL query I.e. userID + orderNumber =
  filename. Is this possible? 'cause I've tried every option I can think
  of and am not winng.
 
  Thanks a ton
 
  Haig
 
  Sent from my iPhone
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Perhaps he's trying to do URL rewrite without the URL rewrite?

---End Message---
---BeginMessage---
On Mon, 21 Sep 2009 00:43:24 +0200
Ralph Deffke ralph_def...@yahoo.de wrote:

 Hi Haig,
 
 it would be better if u tell us what purpose u want to solf with this
 approuch. Its hard to understand for a prov why u want to create a
 filename .php
 .php files are scrips containing functions or classes,
 called/instantinated with parameters.
 why the hell u want to create a filename with these parameters? does
 this file excist?
 you can create 'dynamic code' in php, but u would never write it to a
 file!
 
 understand that that question is wierd and appears that ur concept is
 wild and realy sick.
 
 ralph_def...@yahoo.de

Hi Ralph,

First, please don't top-post.

Second, please use complete words. 'u' is not a word.

Third, I have no idea why you feel that such an knee-jerk reaction and
abusive post would be helpful or useful. If you have nothing to add to
the conversation, do not post. 

 Haig Davis level...@gmail.com wrote in message
 news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
  Good Afternoon All,
 
  Thanks for the help with the checkbox issue the other day.
 
  Todays question: I want to create a filename.php from a variable
  more specifically the results if a mySQL query I.e. userID +
  orderNumber = filename. Is this possible? 'cause I've tried every
  

[PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
Hi All,

I am creating a social networking website. I want that every user should
have there own profile page with a static URL like-

http://www.abcnetwork/user/username

Where username will be dynamic userid or something else.

This is something very similar to www.youtube.com/user/kumargauravmail (this
is my profile page).

So what should be the best practice to create such DYNAMIC URL's OR what
kind of methodology youtube is following?

Thanks in Advance.

Gaurav Kumar
OSWebstudio.com


Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Gaurav Kumar kumargauravjuke...@gmail.com
 To: php-general@lists.php.net
 Sent: Monday, September 21, 2009 12:54:30 AM
 Subject: [PHP] Best Practice to Create Dynamic URL's- With Username
 
 Hi All,
 
 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-
 
 http://www.abcnetwork/user/username
 
 Where username will be dynamic userid or something else.
 
 This is something very similar to www.youtube.com/user/kumargauravmail (this
 is my profile page).
 
 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?
 
 Thanks in Advance.
 
 Gaurav Kumar
 OSWebstudio.com

Assuming the 'username' is from DB, look into URL rewrite. Thus, client see this

http://www.abcnetwork/user/username

which translates into this  (or something similar) to PHP

http://www.abcnetwork/userProfile.php?user=username

Of course, you'll need to handle the 404 just in case ;)

Regards,
Tommy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 13:24 +0530, Gaurav Kumar wrote:
 Hi All,
 
 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-
 
 http://www.abcnetwork/user/username
 
 Where username will be dynamic userid or something else.
 
 This is something very similar to www.youtube.com/user/kumargauravmail (this
 is my profile page).
 
 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?
 
 Thanks in Advance.
 
 Gaurav Kumar
 OSWebstudio.com

If you're working on an Apache server, your best bet is to look at
mod_rewrite. You can write a simple rule to match against these sorts of
URL formats, so that to your visitors it appears as if the actual path
exists, but internally it can get translated to something like
http://www.abcnetwork.com/profile.php?id=username 

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ralph Deffke
be aware if you do not have full control of your server setup, this type of
parameter handling is not possible on most shared hostings.

however url encoded it is never a problem. so be clear where yout page will
be hosted.

ralph_def...@yahoo.de

Gaurav Kumar kumargauravjuke...@gmail.com wrote in message
news:87292e170909210054k79858b96yf09eeca5111ec...@mail.gmail.com...
 Hi All,

 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-

 http://www.abcnetwork/user/username

 Where username will be dynamic userid or something else.

 This is something very similar to www.youtube.com/user/kumargauravmail
(this
 is my profile page).

 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?

 Thanks in Advance.

 Gaurav Kumar
 OSWebstudio.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Richard Heyes
Hi,

 ...

As has been suggested you could use mod_rewrite, but you don't have to
if your needs are simple (or maybe you don't have it). You could also
use the ForceType directive. Eg on my website the URLs are like this:

http://www.phpguru.org/article/20-years-of-php

Where article is actually a PHP file without the .php extension.
It's forced to run as a PHP file using this:

Files article 
ForceType application/x-httpd-php
/Files

And you will find the URL in $_SERVER somewhere.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Creating file name with $variable

2009-09-21 Thread Lars Torben Wilson
On Mon, 21 Sep 2009 00:43:24 +0200
Ralph Deffke ralph_def...@yahoo.de wrote:

 Hi Haig,
 
 it would be better if u tell us what purpose u want to solf with this
 approuch. Its hard to understand for a prov why u want to create a
 filename .php
 .php files are scrips containing functions or classes,
 called/instantinated with parameters.
 why the hell u want to create a filename with these parameters? does
 this file excist?
 you can create 'dynamic code' in php, but u would never write it to a
 file!
 
 understand that that question is wierd and appears that ur concept is
 wild and realy sick.
 
 ralph_def...@yahoo.de

Hi Ralph,

First, please don't top-post.

Second, please use complete words. 'u' is not a word.

Third, I have no idea why you feel that such an knee-jerk reaction and
abusive post would be helpful or useful. If you have nothing to add to
the conversation, do not post. 

 Haig Davis level...@gmail.com wrote in message
 news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
  Good Afternoon All,
 
  Thanks for the help with the checkbox issue the other day.
 
  Todays question: I want to create a filename.php from a variable
  more specifically the results if a mySQL query I.e. userID +
  orderNumber = filename. Is this possible? 'cause I've tried every
  option I can think of and am not winng.
 
  Thanks a ton
 
  Haig

Hi Haig,

Yes, this is possible; there is nothing special about creating such a
file. Simply construct the filename as a string in normal PHP fashion,
and then use that filename with file_put_contents(), fopen(), or
similar, to create the file. 

It will be hard to help you further without an example (as short as you
can make it) of what you are trying to do, and an explanation of how
it's failing to do what you want it to do.

Please post a short example of the code you have which is failing, and
a longer explanation of exactly what you want to achieve, and perhaps we
can explain how to make it work or suggest a better solution to your
problem.

Ralph did get one thing right, in that it's generally better to explain
what you're trying to do instead of explaining how you're trying to do
it. There are many ways to do almost any task, so it is possible that
there is another way to do what you want which is simpler and less
error-prone.


Regards,

Torben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
A Big Thanks to all of you.

Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer, but
I wonder why you choose /user/username rather than just /username a la
twitter.

I will be using many other aspects of my users something like
/projects/username/; /gallery/username/.

OK Ashley, Tommy and Ralph-

100% correct that mod_rewrite will be used.

I am a bit sticky that my URL will be-
http://www.abcnetwork/user/*Ashley*http://www.abcnetwork/user/username.

So will I get $_GET[user] with value as *Ashley* or *Tommy* in my
script?

http://www.abcnetwork/userProfile.php?user=usernameSo what exactly will be
the .htaccess rule for above?


Thanks,

Gaurav Kumar
OSWebstudio.Com



On Mon, Sep 21, 2009 at 1:26 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Mon, 2009-09-21 at 13:24 +0530, Gaurav Kumar wrote:
  Hi All,
 
  I am creating a social networking website. I want that every user should
  have there own profile page with a static URL like-
 
  http://www.abcnetwork/user/username
 
  Where username will be dynamic userid or something else.
 
  This is something very similar to www.youtube.com/user/kumargauravmail(this
  is my profile page).
 
  So what should be the best practice to create such DYNAMIC URL's OR what
  kind of methodology youtube is following?
 
  Thanks in Advance.
 
  Gaurav Kumar
  OSWebstudio.com

 If you're working on an Apache server, your best bet is to look at
 mod_rewrite. You can write a simple rule to match against these sorts of
 URL formats, so that to your visitors it appears as if the actual path
 exists, but internally it can get translated to something like
 http://www.abcnetwork.com/profile.php?id=username

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk






RE: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Andrea Giammarchi



 
 Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer, but
 I wonder why you choose /user/username rather than just /username a la
 twitter.
 
 I will be using many other aspects of my users something like
 /projects/username/; /gallery/username/.

well, it does not matter if this service is user based.

/username/ #as user home page

/username/projects/ #as user projects

/username/gallery/ #as user gallery

/username/etc ...

it's just a silly point but from user home page you isntantly know if user 
exists and you instantly know subsections

In your way you assume that there is a gallery for that user while he could 
have created only projects, without galleries.
So one search failed, while to go in the user page I need to digit /user/ 
before, not a big deal but we are in tinyurl and bit.ly era

Google Code put simply a /p/ as prefix plus the project name plus subsection


/p/myprojname/

/p/myprojname/wiki

since you are starting now, maybe you could consider this semantic alternative, 
if it suits your requirements.

Regards
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
I totally agree with this architecture.

You are correct, I am just in the starting phase of the project and in fact
still need to define the architecture in detail.

Now the question I asked in my last reply is still to be answered?

Gaurav Kumar
OSWebstudio.Com

On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi an_...@hotmail.comwrote:



 
  Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer,
 but
  I wonder why you choose /user/username rather than just /username a la
  twitter.
 
  I will be using many other aspects of my users something like
  /projects/username/; /gallery/username/.

 well, it does not matter if this service is user based.

 /username/ #as user home page
 /username/projects/ #as user projects
 /username/gallery/ #as user gallery
 /username/etc ...

 it's just a silly point but from user home page you isntantly know if user
 exists and you instantly know subsections

 In your way you assume that there is a gallery for that user while he could
 have created only projects, without galleries.
 So one search failed, while to go in the user page I need to digit /user/
 before, not a big deal but we are in tinyurl and bit.ly era

 Google Code put simply a /p/ as prefix plus the project name plus
 subsection

 /p/myprojname/
 /p/myprojname/wiki

 since you are starting now, maybe you could consider this semantic
 alternative, if it suits your requirements.

 Regards
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
  

 --
 check out the rest of the Windows Live™. More than mail–Windows Live™ goes
 way beyond your inbox. More than 
 messageshttp://www.microsoft.com/windows/windowslive/



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
 I totally agree with this architecture. 
 
 You are correct, I am just in the starting phase of the project and in
 fact still need to define the architecture in detail.
 
 Now the question I asked in my last reply is still to be answered?
 
 Gaurav Kumar
 OSWebstudio.Com
 
 On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
 an_...@hotmail.com wrote:
 
 
  
  Question I was Asked by Andrea- mod_reqrite or .htaccess is
 the answer, but
  I wonder why you choose /user/username rather than
 just /username a la
  twitter.
  
  I will be using many other aspects of my users something
 like
  /projects/username/; /gallery/username/.
 
 
 well, it does not matter if this service is user based.
 
 /username/ #as user home page
 /username/projects/ #as user projects
 /username/gallery/ #as user gallery
 /username/etc ...
 
 it's just a silly point but from user home page you isntantly
 know if user exists and you instantly know subsections
 
 In your way you assume that there is a gallery for that user
 while he could have created only projects, without galleries.
 So one search failed, while to go in the user page I need to
 digit /user/ before, not a big deal but we are in tinyurl and
 bit.ly era
 
 Google Code put simply a /p/ as prefix plus the project name
 plus subsection
 
 /p/myprojname/
 /p/myprojname/wiki
 
 since you are starting now, maybe you could consider this
 semantic alternative, if it suits your requirements.
 
 Regards
 
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
  
 
 
 
 __
 check out the rest of the Windows Live™. More than mail–
 Windows Live™ goes way beyond your inbox. More than messages
 
For help with the mod_rewrite, a Google search never goes amiss, first
result I found for 'mod_rewrite example' is
http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
at it quickly and it does cover what you need.

As for what you get as $_GET parameters, that's entirely up to you, and
as you will see from the above link, it's fairly simple to mess about
with.


Thanks,
Ash
http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
Thanks Ashley and all the folks out there...

On Mon, Sep 21, 2009 at 3:25 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
  I totally agree with this architecture.
 
  You are correct, I am just in the starting phase of the project and in
  fact still need to define the architecture in detail.
 
  Now the question I asked in my last reply is still to be answered?
 
  Gaurav Kumar
  OSWebstudio.Com
 
  On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
  an_...@hotmail.com wrote:
 
 
  
   Question I was Asked by Andrea- mod_reqrite or .htaccess is
  the answer, but
   I wonder why you choose /user/username rather than
  just /username a la
   twitter.
  
   I will be using many other aspects of my users something
  like
   /projects/username/; /gallery/username/.
 
 
  well, it does not matter if this service is user based.
 
  /username/ #as user home page
  /username/projects/ #as user projects
  /username/gallery/ #as user gallery
  /username/etc ...
 
  it's just a silly point but from user home page you isntantly
  know if user exists and you instantly know subsections
 
  In your way you assume that there is a gallery for that user
  while he could have created only projects, without galleries.
  So one search failed, while to go in the user page I need to
  digit /user/ before, not a big deal but we are in tinyurl and
  bit.ly era
 
  Google Code put simply a /p/ as prefix plus the project name
  plus subsection
 
  /p/myprojname/
  /p/myprojname/wiki
 
  since you are starting now, maybe you could consider this
  semantic alternative, if it suits your requirements.
 
  Regards
 
Thanks,
Ash
http://www.ashleysheridan.co.uk
   
   
   
   
 
 
 
  __
  check out the rest of the Windows Live™. More than mail–
  Windows Live™ goes way beyond your inbox. More than messages
 
 For help with the mod_rewrite, a Google search never goes amiss, first
 result I found for 'mod_rewrite example' is
 http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
 at it quickly and it does cover what you need.

 As for what you get as $_GET parameters, that's entirely up to you, and
 as you will see from the above link, it's fairly simple to mess about
 with.


 Thanks,
 Ash
 http://www.ashleysheridan.co.uk






Re: [PHP] Re: Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Ralph Deffke ralph_def...@yahoo.de
 To: php-general@lists.php.net
 Sent: Monday, September 21, 2009 1:31:05 AM
 Subject: [PHP] Re: Best Practice to Create Dynamic URL's- With Username
 
 be aware if you do not have full control of your server setup, this type of
 parameter handling is not possible on most shared hostings.
 
 however url encoded it is never a problem. so be clear where yout page will
 be hosted.
 
 ralph_def...@yahoo.de
 

If your hosting service company doesn't permit/use URL rewrite (mod_rewrite for 
Apache), then ask them to specify a 404 error page for you.  You can then do an 
ugly hack of URL rewrite in your (PHP)  404 error page so the URL will be SEF ;)

Regards,
Tommy

 Gaurav Kumar wrote in message
 news:87292e170909210054k79858b96yf09eeca5111ec...@mail.gmail.com...
  Hi All,
 
  I am creating a social networking website. I want that every user should
  have there own profile page with a static URL like-
 
  http://www.abcnetwork/user/username
 
  Where username will be dynamic userid or something else.
 
  This is something very similar to www.youtube.com/user/kumargauravmail
 (this
  is my profile page).
 
  So what should be the best practice to create such DYNAMIC URL's OR what
  kind of methodology youtube is following?
 
  Thanks in Advance.
 
  Gaurav Kumar
  OSWebstudio.com
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Ashley Sheridan a...@ashleysheridan.co.uk
 To: Gaurav Kumar kumargauravjuke...@gmail.com
 Cc: Andrea Giammarchi an_...@hotmail.com; php-general@lists.php.net
 Sent: Monday, September 21, 2009 2:55:20 AM
 Subject: Re: [PHP] Best Practice to Create Dynamic URL's- With Username
 
 On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
  I totally agree with this architecture. 
  
  You are correct, I am just in the starting phase of the project and in
  fact still need to define the architecture in detail.
  
  Now the question I asked in my last reply is still to be answered?
  
  Gaurav Kumar
  OSWebstudio.Com
  
  On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
  wrote:
 
 
   
   Question I was Asked by Andrea- mod_reqrite or .htaccess is
  the answer, but
   I wonder why you choose /user/username rather than
  just /username a la
   twitter.
   
   I will be using many other aspects of my users something
  like
   /projects/username/; /gallery/username/.
 
 
  well, it does not matter if this service is user based.
 
  /username/ #as user home page
  /username/projects/ #as user projects
  /username/gallery/ #as user gallery
  /username/etc ...
 
  it's just a silly point but from user home page you isntantly
  know if user exists and you instantly know subsections
 
  In your way you assume that there is a gallery for that user
  while he could have created only projects, without galleries.
  So one search failed, while to go in the user page I need to
  digit /user/ before, not a big deal but we are in tinyurl and
 bit.ly era
 
  Google Code put simply a /p/ as prefix plus the project name
  plus subsection
 
  /p/myprojname/
  /p/myprojname/wiki
 
  since you are starting now, maybe you could consider this
  semantic alternative, if it suits your requirements.
 
  Regards
 
Thanks,
Ash
http://www.ashleysheridan.co.uk
   
   
   
   
 
 
 
  __
  check out the rest of the Windows Live™. More than mail–
  Windows Live™ goes way beyond your inbox. More than messages
  
 For help with the mod_rewrite, a Google search never goes amiss, first
 result I found for 'mod_rewrite example' is
 http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
 at it quickly and it does cover what you need.
 
 As for what you get as $_GET parameters, that's entirely up to you, and
 as you will see from the above link, it's fairly simple to mess about
 with.
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 

Ash,

What's the IP that the link you gave resolve to?  I'm getting timed out for the 
DNS lookup on my end ... 

Thanks,
Tommy

 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 03:42 -0700, Tommy Pham wrote:
 - Original Message 
  From: Ashley Sheridan a...@ashleysheridan.co.uk
  To: Gaurav Kumar kumargauravjuke...@gmail.com
  Cc: Andrea Giammarchi an_...@hotmail.com; php-general@lists.php.net
  Sent: Monday, September 21, 2009 2:55:20 AM
  Subject: Re: [PHP] Best Practice to Create Dynamic URL's- With Username
  
  On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
   I totally agree with this architecture. 
   
   You are correct, I am just in the starting phase of the project and in
   fact still need to define the architecture in detail.
   
   Now the question I asked in my last reply is still to be answered?
   
   Gaurav Kumar
   OSWebstudio.Com
   
   On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
   wrote:
  
  

Question I was Asked by Andrea- mod_reqrite or .htaccess is
   the answer, but
I wonder why you choose /user/username rather than
   just /username a la
twitter.

I will be using many other aspects of my users something
   like
/projects/username/; /gallery/username/.
  
  
   well, it does not matter if this service is user based.
  
   /username/ #as user home page
   /username/projects/ #as user projects
   /username/gallery/ #as user gallery
   /username/etc ...
  
   it's just a silly point but from user home page you isntantly
   know if user exists and you instantly know subsections
  
   In your way you assume that there is a gallery for that user
   while he could have created only projects, without galleries.
   So one search failed, while to go in the user page I need to
   digit /user/ before, not a big deal but we are in tinyurl and
  bit.ly era
  
   Google Code put simply a /p/ as prefix plus the project name
   plus subsection
  
   /p/myprojname/
   /p/myprojname/wiki
  
   since you are starting now, maybe you could consider this
   semantic alternative, if it suits your requirements.
  
   Regards
  
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




  
  
  
   __
   check out the rest of the Windows Live™. More than mail–
   Windows Live™ goes way beyond your inbox. More than messages
   
  For help with the mod_rewrite, a Google search never goes amiss, first
  result I found for 'mod_rewrite example' is
  http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
  at it quickly and it does cover what you need.
  
  As for what you get as $_GET parameters, that's entirely up to you, and
  as you will see from the above link, it's fairly simple to mess about
  with.
  
  
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
  
  
 
 Ash,
 
 What's the IP that the link you gave resolve to?  I'm getting timed out for 
 the DNS lookup on my end ... 
 
 Thanks,
 Tommy
 
  
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

I get 80.82.121.153 for it. You might have an issue with your DNS
server. There are a lot of freely available alternative DNS servers
about the world that you can use instead. I had to do that myself one
time, when the DNS server issued by my ISP was misbehaving and I was
getting lots of timeouts just like you are getting.

Thanks,
Ash
http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Random Flash Movies

2009-09-21 Thread Gary
As always, thanks for your help.

Gary


Gary gwp...@ptd.net wrote in message 
news:68.43.09009.cba46...@pb1.pair.com...
A question was posted on another board that the poster wanted random flash 
movies to display as the page is reloaded.  I posted the script below and 
said I thought it could be adapted but that the echo would probably need to 
change. Can someone offer some guidance on this?  Thanks

 Gary

 ?
 //Chooses a random number
 $num = Rand (1,6);
 //Based on the random number, gives a quote
 switch ($num)
 {
 case 1:
 echo ;
 break;
 case 2:
 echo ;
 break;
 case 3:
 echo ;
 break;
 case 4:
 echo ;
 break;
 case 5:
 echo ;
 break;
 case 6:
 echo ;
 }
 ?


 __ Information from ESET Smart Security, version of virus 
 signature database 4441 (20090919) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





 __ Information from ESET Smart Security, version of virus 
 signature database 4442 (20090921) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 



__ Information from ESET Smart Security, version of virus signature 
database 4442 (20090921) __

The message was checked by ESET Smart Security.

http://www.eset.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Touch screen programming help

2009-09-21 Thread Bastien Koert
On Mon, Sep 21, 2009 at 9:29 AM, Robert Cummings rob...@interjinn.com wrote:


 Tommy Pham wrote:

  Original Message 

 From: Manish - dz - PHP man...@dotzoo.net
 To: php-general@lists.php.net
 Sent: Monday, September 21, 2009 5:32:59 AM
 Subject: [PHP] Touch screen programming help

 Hi    Is it possible to do touch screen programming  in PHP ? If it is
 then, how ?
   Please specify th specs with code.

 Thanks in advance,

 Regards,
 Manish

 Did you research on 'touch screen'?  How it works? The hardware  software
 involved?

 You forgot to include specs and code in your response.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



php|arch magazine had an article about this some years back, search
their archives. Its more than possible, but you will likely need to
install apache/php/mysql on the machine that run the device (assuming
its a kiosk type machine)

-- 

Bastien

Cat, the other other white meat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Touch screen programming help

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Robert Cummings rob...@interjinn.com
 To: Tommy Pham tommy...@yahoo.com
 Cc: Manish - dz - PHP man...@dotzoo.net; php-general@lists.php.net
 Sent: Monday, September 21, 2009 6:29:01 AM
 Subject: Re: [PHP] Touch screen programming help
 
 
 
 Tommy Pham wrote:
   Original Message 
  From: Manish - dz - PHP 
  To: php-general@lists.php.net
  Sent: Monday, September 21, 2009 5:32:59 AM
  Subject: [PHP] Touch screen programming help
  
  Hi Is it possible to do touch screen programming  in PHP ? If it is 
  then, 
 how ?
 Please specify th specs with code.
  
  Thanks in advance,
  
  Regards,
  Manish
  
  Did you research on 'touch screen'?  How it works? The hardware  software 
 involved?
 
 You forgot to include specs and code in your response.
 
 Cheers,
 Rob.
 -- http://www.interjinn.com
 Application and Templating Framework for PHP
 
 -- PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

You know that's what happens when the brain process too fast for the fingers to 
keep up :D


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Touch screen programming help

2009-09-21 Thread Ralph Deffke
well, I would say a touch screen usualy is just another 'pointing device'
like the mouse is. it depends on the operating system and the driver setup
for it. then u simply can use any browser and just adjust the pointing
receiving elements like buttons and links a bit bigger and with images
rather then with just text. However this is not realy a PHP related issue.
more like a designers issue.

I think its realy simple

ralph_def...@yahoo.de

Manish - dz - PHP man...@dotzoo.net wrote in message
news:013c01ca3ab7$a9524dd0$5e01a...@manish...
Hi
Is it possible to do touch screen programming  in PHP ? If it is then,
how ?
   Please specify th specs with code.

Thanks in advance,

Regards,
Manish




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Usage of strlen(tuf8_decode()) and /u regex modifier

2009-09-21 Thread GoForThisWorld

Hello,

  As indicated below, the strlen(tuf8_decode()) and the /u regex
  modifier do not work as per my understanding.  

  1) What is my misunderstanding?  

  ?php
  
  $the_string = '#1052;#1072;#1088;#1080;#1085;#1072; 
#1054;#1088;#1083;#1086;#1074;#1072;';
  echo pauthor (85 bytes):$the_string, . strlen($the_string) . ',' 
. strlen( utf8_decode( $the_string ) ) . ',' .
strlen( utf8_decode( utf8_encode($the_string) ) ) . ',' .  /p;
  // all the number echoed are 85, I expected at least one to be 13

  
  $max_length = 20;
  $is_short = preg_match( '/^.{1,$max_length}$/u', uft8_encode( 
$the_string ) ) );
  // expect the above to return 1
  
  $max_length = 10;
  $is_short = preg_match( '/^.{1,$max_length}$/u', uft8_encode( 
$the_string ) ) );
  // expect the above to return 0
  
  ?

  More generally, given a string $the_string:

  2) how to determine what encoding is being used?

  3) how to determine the number of visible characters?

  4) if it has more than N visible characters, how to 
 truncate it after N visible characters?

  Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Usage of strlen(tuf8_decode()) and /u regex modifier

2009-09-21 Thread Andrea Giammarchi




   $the_string = '#1052;#1072;#1088;#1080;#1085;#1072; 
 #1054;#1088;#1083;#1086;#1074;#1072;';

did you actually wrote this or i tis the PHP ml that converted utf-8 chars?
I can read only an ASCII string with length 85 ... please tell me you are not 
confusing HTML entities with UTF-8 encoded characters ...

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

[PHP] Extract links from strings

2009-09-21 Thread Jônatas Zechim
Hi there, i've the following strings:

$string1 = 'Lorem ipsum dolor http://site.com sit amet';
$string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
$string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

How can I extract the URL from these strings?
They can be [http:// + url] or [www. + url].

Zechim


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Extract links from strings

2009-09-21 Thread Paul M Foster
On Mon, Sep 21, 2009 at 12:52:12PM -0300, Jônatas Zechim wrote:

 Hi there, i've the following strings:
 
 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
 
 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].
 

Use the preg_match() function (see
http://us2.php.net/manual/en/function.preg-match.php ) and a good
regular expression from a place like http://www.regexlib.com/ .

Paul

-- 
Paul M. Foster

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Extract links from strings

2009-09-21 Thread tedd

At 12:52 PM -0300 9/21/09, Jônatas Zechim wrote:

Hi there, i've the following strings:

$string1 = 'Lorem ipsum dolor http://site.com sit amet';
$string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
$string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

How can I extract the URL from these strings?
They can be [http:// + url] or [www. + url].

Zechim



Not tested:

?php

$textString = 'orem ipsum dolor sit amet, consectetuer adipiscing
elit. Proin et urna. Duis quam. Suspendisse potenti. Etiam sem tortor,
ultricies nec,  http://example.com  imperdiet nec, tempus ac, purus.
Suspendisse id lectus. Nam vitae quam. Aliquam ligula nisl, vestibulum
vulputate, tempor nec, https://www.example.com  tincidunt sit amet,
libero. Suspendisse a justo. Cum sociis natoque penatibus et.';

$url_regexp = 
'(?:(?:https?)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@=+$,a-zA-Z0-9\\-_.!~*\'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)';


$output = preg_replace($url_regexp, 'a href=$0$0/a', $textString);

print $output;
?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Extract links from strings

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 11:06 -0700, Mattias Thorslund wrote:
 Jônatas Zechim wrote:
  Hi there, i've the following strings:
 
  $string1 = 'Lorem ipsum dolor http://site.com sit amet';
  $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
  $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
 
  How can I extract the URL from these strings?
  They can be [http:// + url] or [www. + url].
 
  Zechim
 
 Simple:
 
 function RemoveLorem($string)
 {
 return str_replace(array('Lorem ipsum dolor ', ' sit amet'), '', 
 $string);
 }
 
 $url1 = RemoveLorem($string1);
 $url2 = RemoveLorem($string2);
 $url3 = RemoveLorem($string3);
 
 Cheers :-)
 
 Mattias
 
Erm, I think the Lorem Ipsum was just filler text in this example, and
may not actually occur in the final content ;)


Thanks,
Ash
http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] wrong time stamp in log filewrong time stamp in log file

2009-09-21 Thread Struzik Wojciech
I have updated a php to version 5.2.11. the timestamp in php log is
incorrect. the time differs from local time with 2 hours. In changelog
I can find the following information:
Updated timezone database to version 2009.13 (2009m) (Derick)
Is it related with my problem ???

When I run the following script:
?php
print date('d M Y, H:i');
?
It's returns a correct time.

I appreciate any help


Re: [PHP] Extract links from strings

2009-09-21 Thread Mattias Thorslund

Jônatas Zechim wrote:

Hi there, i've the following strings:

$string1 = 'Lorem ipsum dolor http://site.com sit amet';
$string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
$string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

How can I extract the URL from these strings?
They can be [http:// + url] or [www. + url].

Zechim


Simple:

function RemoveLorem($string)
{
   return str_replace(array('Lorem ipsum dolor ', ' sit amet'), '', 
$string);

}

$url1 = RemoveLorem($string1);
$url2 = RemoveLorem($string2);
$url3 = RemoveLorem($string3);

Cheers :-)

Mattias

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] wrong time stamp in log filewrong time stamp in log file

2009-09-21 Thread Andrea Giammarchi


 I have updated a php to version 5.2.11.
you should update the keyboard as well, it fires CTRL+V twice (subject, and I 
am joking ..)


 When I run the following script:
 ?php
 print date('d M Y, H:i');
 ?
 It's returns a correct time.

correct accordingly with your local time zone, 'cause I am pretty much sure 
that if you do
?php
print *gmdate*('d M Y, H:i');
?
the time will be exactly the same reported in the log file.

You would have known this if you were developing with E_STRICT since date is a 
warning, even in the phpinfo, if you do not set it correctly.

It's a good idea in any case, for obvious portability reasons across websites, 
countries, and hosts, to use gmdate for time operations, otherwise if I use 
date I could have stuff from the future in another host, and stuff from past in 
another one.

Regards

_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

[PHP] webpage link validation

2009-09-21 Thread Al

What's the simplest way to test if a link is valid?

I've got a script that throughly checks the dns, etc. But, I'd also like to 
check to see if the user has inputted a valid link to a webpage.


File_exists() and etc. seem to have a lot of caveats.

E.g., foo.com/bar/file.txt

Most things I've looked at are gross overkill.

Al

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] webpage link validation

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 14:42 -0400, Al wrote:
 What's the simplest way to test if a link is valid?
 
 I've got a script that throughly checks the dns, etc. But, I'd also like to 
 check to see if the user has inputted a valid link to a webpage.
 
 File_exists() and etc. seem to have a lot of caveats.
 
 E.g., foo.com/bar/file.txt
 
 Most things I've looked at are gross overkill.
 
 Al
 

Several ways that I can think of:

  * use the file_get_contents() which like you said, could be
overkill
  * shell out to wget to retrieve just the headers for the path.
You'd be looking for a 200 return code, which indicates the URI
exists.
  * lastly, you could use fopen() to open the file, and use the
return from the fopen() call to indicate a success of failure

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] webpage link validation

2009-09-21 Thread Andrea Giammarchi

 
 Several ways that I can think of:
 
   * use the file_get_contents() which like you said, could be
 overkill
   * shell out to wget to retrieve just the headers for the path.
 You'd be looking for a 200 return code, which indicates the URI
 exists.
   * lastly, you could use fopen() to open the file, and use the
 return from the fopen() call to indicate a success of failure
 
 Thanks,
 Ash

you forgot probably the best one, an HEAD call via curl library ( 
http://uk3.php.net/curl ) if present

Regards

_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

RES: [PHP] Extract links from strings

2009-09-21 Thread Jônatas Zechim
I don't think so, but I've found this (from PT-BR LIST):

$string = 'Lorem ipsum dolor http://site.com sit amet lorem www.google.com
';

preg_match_all('!(?:http://|www)[^ ]*!',$string,$links);

print_r($links);

Zechim

-Mensagem original-
De: Mattias Thorslund [mailto:matt...@thorslund.us] 
Enviada em: segunda-feira, 21 de setembro de 2009 15:07
Para: 'PHP-General List'
Assunto: Re: [PHP] Extract links from strings

Jônatas Zechim wrote:
 Hi there, i've the following strings:

 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].

 Zechim

Simple:

function RemoveLorem($string)
{
return str_replace(array('Lorem ipsum dolor ', ' sit amet'), '', 
$string);
}

$url1 = RemoveLorem($string1);
$url2 = RemoveLorem($string2);
$url3 = RemoveLorem($string3);

Cheers :-)

Mattias

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] wrong time stamp in log filewrong time stamp in log file

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Andrea Giammarchi an_...@hotmail.com
 To: bm9ib...@gmail.com; php-general@lists.php.net
 Sent: Monday, September 21, 2009 11:41:01 AM
 Subject: RE: [PHP] wrong time stamp in log filewrong time stamp in log file
 
 
 
  I have updated a php to version 5.2.11.
 you should update the keyboard as well, it fires CTRL+V twice (subject, and I 
 am 
 joking ..)
 
 
  When I run the following script:
print date('d M Y, H:i');
  ?
  It's returns a correct time.
 
 correct accordingly with your local time zone, 'cause I am pretty much sure 
 that 
 if you do
  print *gmdate*('d M Y, H:i');
 ?
 the time will be exactly the same reported in the log file.
 
 You would have known this if you were developing with E_STRICT since date is 
 a 
 warning, even in the phpinfo, if you do not set it correctly.
 
 It's a good idea in any case, for obvious portability reasons across 
 websites, 
 countries, and hosts, to use gmdate for time operations, otherwise if I use 
 date 
 I could have stuff from the future in another host, and stuff from past in 
 another one.
 
 Regards
 
 _
 Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
 
 http://www.microsoft.com/windows/windowslive/products/photos.aspx

Did you set 'Default timezone' in php.ini or use the function 
date_default_timezone_set() in your app?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Extract links from strings

2009-09-21 Thread Jim Lucas
Jônatas Zechim wrote:
 Hi there, i've the following strings:
 
 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
 
 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].
 
 Zechim
 
 

Something like this should work for you.

plaintext?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
print_r($m);
}
}

?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Extract links from strings

2009-09-21 Thread Jim Lucas
Jim Lucas wrote:
 Jônatas Zechim wrote:
 Hi there, i've the following strings:

 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].

 Zechim


 
 Something like this should work for you.
 
 plaintext?php
 
 $urls[] = 'Lorem ipsum dolor http://site.com sit amet';
 $urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
 $urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
 $urls[] = 'Lorem ipsum dolor www site2.net sit amet';
 
 foreach ( $urls AS $url ) {
   if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
   print_r($m);
   }
 }
 
 ?
 

Actually, try this.  It seems to work a little better.

plaintext?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ or http://www.site2.com/';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
if ( preg_match_all('%(https?://[^\s]+|www\.[^\s]+)%',
$url,
$m,
(PREG_SET_ORDER ^ PREG_OFFSET_CAPTURE)
) ) {
print_r($m);
}
}

?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Validation XHTML code and repairing broken one

2009-09-21 Thread Manuel Lemos
Hello,

on 09/17/2009 06:33 AM Dušan Novaković said the following:
 I have few questions about validation XHTML and repairing if it's
 broken. The problem is that I have some, for example HTML code (simple
 web page) and want to load that page to DOMDocument and than make
 something of it. That part works perfect, but if there is unclosed tag
 or something like that when I try to load that page I get an error
 because now that code is not valid. So my question would be, is there
 some way that I could build some script in php that would run thought
 that page and check if it's valid or not, and if it's not than try to
 repair it. Something that you have in all tools, for example Eclipse,
 NetBeans, etc. If anyone have any idea, please help me, because I'm
 stuck in here :-(

You may want to try this HTML parser package. It is tolerating to
malformed HTML documents. It returns a stream of document elements, such
as tags, data, character entities, etc.. that you can pass back to the
class and regenerate a well-formed document. It comes even with filter
class that validates the document against a DTD and adds missing closed
tags and such.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] using a USB device (flash) in the Virtualbox

2009-09-21 Thread chamba kasonde
Hi!
I am a new user of this feature and tool and would like to transfer data and 
info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
platform.
My first version of Virtualbox was 2._ _ _ which said it did not support that 
feature.
Therefore, I upgraded to 3._ _ _ which supports it but the flash does not show 
nor appear in the XP window.
How do I get to use my flash on both parallel running systems?