php-general Digest 27 Dec 2007 23:27:02 -0000 Issue 5203

2007-12-27 Thread php-general-digest-help

php-general Digest 27 Dec 2007 23:27:02 - Issue 5203

Topics (messages 266291 through 266312):

Re: Match for titles using pregexp
266291 by: Robert Cummings
266292 by: OOzy Pal
266293 by: Robert Cummings

Re: control browser with a href tag
266294 by: Hiep Nguyen
266295 by: Daniel Brown
266296 by: Andrés Robinet

vim/php color scheme
266297 by: OOzy Pal
266298 by: Nathan Nobbe
266299 by: Daniel Brown
266301 by: OOzy Pal
266302 by: Nathan Nobbe
266304 by: Daniel Brown
266309 by: OOzy Pal
266310 by: Daniel Brown
266311 by: OOzy Pal

fopen() for http:// sometimes working, sometimes not
266300 by: Albert Wiersch
266303 by: Daniel Brown
266305 by: Albert Wiersch
266306 by: Albert Wiersch
266307 by: Daniel Brown
266308 by: Daniel Brown
266312 by: Albert Wiersch

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]


--
---BeginMessage---
On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
 more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
 words/chars
 
 How can I match for the title. In this case the word Hello using regexp?

?php

$text = 'more words/chars[a href=#c_1 id=ids_1
title=Hello2/a]more words/chars';

$title = null;
if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
{
$title = $bits[1];
}
 
echo 'Title: '.$title.\n;

?

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

Leveraging the buying power of the masses!
...
---End Message---
---BeginMessage---
On Dec 27, 2007 12:40 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
  more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
  words/chars
 
  How can I match for the title. In this case the word Hello using regexp?

 ?php

 $text = 'more words/chars[a href=#c_1 id=ids_1
 title=Hello2/a]more words/chars';

 $title = null;
 if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
 {
 $title = $bits[1];
 }

 echo 'Title: '.$title.\n;

 ?

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

 Leveraging the buying power of the masses!
 ...


Wow, worked perfect. Thank you. I just made it (preg_match_all)

more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more words/chars

How can I also find the number 2 in (...2/a...) in the same sentence
and made preg_match_all make array of two items

Array
(
[0] = Hello
[1] = 2

)

-- 
OOzy
Ubuntu-Gutsy (7.10)
---End Message---
---BeginMessage---
On Thu, 2007-12-27 at 13:53 +0300, OOzy Pal wrote:
 On Dec 27, 2007 12:40 PM, Robert Cummings [EMAIL PROTECTED] wrote:
  On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
   more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
   words/chars
  
   How can I match for the title. In this case the word Hello using regexp?
 
  ?php
 
  $text = 'more words/chars[a href=#c_1 id=ids_1
  title=Hello2/a]more words/chars';
 
  $title = null;
  if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
  {
  $title = $bits[1];
  }
 
  echo 'Title: '.$title.\n;
 
  ?

 Wow, worked perfect. Thank you. I just made it (preg_match_all)
 
 more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
 words/chars
 
 How can I also find the number 2 in (...2/a...) in the same sentence
 and made preg_match_all make array of two items
 
 Array
 (
 [0] = Hello
 [1] = 2
 
 )

?php

$text = 'more words/chars[a href=#c_1 id=ids_1
title=Hello2/a]more words/chars';

$title = null;
if( preg_match( '#a[^]*title=([^]*)[^]*([^]*)/a#Umi', $text,
$bits ) )
{
$title = $bits[1];
$content = $bits[2];
}
 
echo 'Title: '.$title.\n
.'Content: '.$content.\n;

?

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

Leveraging the buying power of the masses!
...
---End Message---
---BeginMessage---
Warren Vail [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 i have two pages: list.php and update.php

 list.php will have a hyper link that when click on, it will open a new
 window for user to update info.  once user clicks update button on
 update.php page, i want to close update.php and return to list.php.
 however if user doesn't click update button, i don't want user to go back
 to list.php.  in other word, freeze up list.php until user closes or
 clicks update button on update.php.

 is this possible to do with php?

 Yes and no, 

[PHP] Match for titles using pregexp

2007-12-27 Thread OOzy Pal
more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more words/chars

How can I match for the title. In this case the word Hello using regexp?

-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] Match for titles using pregexp

2007-12-27 Thread OOzy Pal
On Dec 27, 2007 12:40 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
  more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
  words/chars
 
  How can I match for the title. In this case the word Hello using regexp?

 ?php

 $text = 'more words/chars[a href=#c_1 id=ids_1
 title=Hello2/a]more words/chars';

 $title = null;
 if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
 {
 $title = $bits[1];
 }

 echo 'Title: '.$title.\n;

 ?

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

 Leveraging the buying power of the masses!
 ...


Wow, worked perfect. Thank you. I just made it (preg_match_all)

more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more words/chars

How can I also find the number 2 in (...2/a...) in the same sentence
and made preg_match_all make array of two items

Array
(
[0] = Hello
[1] = 2

)

-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] Match for titles using pregexp

2007-12-27 Thread Robert Cummings
On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
 more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
 words/chars
 
 How can I match for the title. In this case the word Hello using regexp?

?php

$text = 'more words/chars[a href=#c_1 id=ids_1
title=Hello2/a]more words/chars';

$title = null;
if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
{
$title = $bits[1];
}
 
echo 'Title: '.$title.\n;

?

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



Re: [PHP] control browser with a href tag

2007-12-27 Thread Hiep Nguyen
Warren Vail [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 i have two pages: list.php and update.php

 list.php will have a hyper link that when click on, it will open a new
 window for user to update info.  once user clicks update button on
 update.php page, i want to close update.php and return to list.php.
 however if user doesn't click update button, i don't want user to go back
 to list.php.  in other word, freeze up list.php until user closes or
 clicks update button on update.php.

 is this possible to do with php?

 Yes and no, don't think you intend to, but you may be mixing technologies.
 You refer to hyperlinks, etc, which is web technologies and windows, which
 is not unless you use javascript or ajax.  With PHP you can cause your
 browser to open a new browser by adding target=_blank to the hyperlink,
 but you cannot easily disable functionality of the old browser (It's still
 open, just usually covered up by the new browser), and if the user clicks
 your hyperlink again a 3rd browser will be opened.  You could name your
 target (target=mypage) which means if the user clicks it a new browser 
 will
 be opened, and if the user clicks the same link again, a 3rd window will 
 not
 be opened, but the page in the mypage target will be refreshed.

 HTH,

 Warren Vail

after read all your replies, i understand and want to redefine the problem.

if user clicks on the hyperlink on list.php page, i want to open a new 
windows for user to update info.  once user clicks update on update.php 
page, i want to close the update.php page automatically and refresh list.php 
page.  i think this is possible.  can someone give me suggestions how to do 
this?

thanks 

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



RE: [PHP] control browser with a href tag

2007-12-27 Thread Andrés Robinet
 -Original Message-
 From: Hiep Nguyen [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 27, 2007 11:51 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] control browser with a href tag
 
 Warren Vail [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  i have two pages: list.php and update.php
 
  list.php will have a hyper link that when click on, it will open a
 new
  window for user to update info.  once user clicks update button on
  update.php page, i want to close update.php and return to list.php.
  however if user doesn't click update button, i don't want user to go
 back
  to list.php.  in other word, freeze up list.php until user closes or
  clicks update button on update.php.
 
  is this possible to do with php?
 
  Yes and no, don't think you intend to, but you may be mixing
 technologies.
  You refer to hyperlinks, etc, which is web technologies and windows,
 which
  is not unless you use javascript or ajax.  With PHP you can cause
 your
  browser to open a new browser by adding target=_blank to the
 hyperlink,
  but you cannot easily disable functionality of the old browser (It's
 still
  open, just usually covered up by the new browser), and if the user
 clicks
  your hyperlink again a 3rd browser will be opened.  You could name
 your
  target (target=mypage) which means if the user clicks it a new
 browser
  will
  be opened, and if the user clicks the same link again, a 3rd window
 will
  not
  be opened, but the page in the mypage target will be refreshed.
 
  HTH,
 
  Warren Vail
 
 after read all your replies, i understand and want to redefine the
 problem.
 
 if user clicks on the hyperlink on list.php page, i want to open a new
 windows for user to update info.  once user clicks update on update.php
 page, i want to close the update.php page automatically and refresh
 list.php
 page.  i think this is possible.  can someone give me suggestions how
 to do
 this?
 
 thanks

Yes, you will need something like this http://www.wildbit.com/labs/modalbox/ or 
a regular javascript popup (window.open).
Modalbox is based on prototype and scriptaculous, but there are other 
lightweight solutions over there too (someone mentioned jQuery and Thickbox I 
think, and there's also a Mootools version called MOOdalbox or something).
This is something you need to program on the client-side (at least most of it), 
so it's not about PHP.

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | 
TEL 954-607-4207 | FAX 954-337-2695
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |  
Web: http://www.bestplace.biz | Web: http://www.seo-diy.com

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



Re: [PHP] Match for titles using pregexp

2007-12-27 Thread Robert Cummings
On Thu, 2007-12-27 at 13:53 +0300, OOzy Pal wrote:
 On Dec 27, 2007 12:40 PM, Robert Cummings [EMAIL PROTECTED] wrote:
  On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
   more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
   words/chars
  
   How can I match for the title. In this case the word Hello using regexp?
 
  ?php
 
  $text = 'more words/chars[a href=#c_1 id=ids_1
  title=Hello2/a]more words/chars';
 
  $title = null;
  if( preg_match( '/title=([^]*)/Umi', $text, $bits ) )
  {
  $title = $bits[1];
  }
 
  echo 'Title: '.$title.\n;
 
  ?

 Wow, worked perfect. Thank you. I just made it (preg_match_all)
 
 more words/chars[a href=#c_1 id=ids_1  title=Hello2/a]more 
 words/chars
 
 How can I also find the number 2 in (...2/a...) in the same sentence
 and made preg_match_all make array of two items
 
 Array
 (
 [0] = Hello
 [1] = 2
 
 )

?php

$text = 'more words/chars[a href=#c_1 id=ids_1
title=Hello2/a]more words/chars';

$title = null;
if( preg_match( '#a[^]*title=([^]*)[^]*([^]*)/a#Umi', $text,
$bits ) )
{
$title = $bits[1];
$content = $bits[2];
}
 
echo 'Title: '.$title.\n
.'Content: '.$content.\n;

?

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 11:00 AM, OOzy Pal [EMAIL PROTECTED] wrote:
 Anyone have a nice color scheme for php syntax highlighting in vim? I
 am using elflord and it is nice but the comment color is like the
 function color which makes it confusing.

I do all of my coding in ViM, and I just use the default colors.
The basic scheme is like this:
* HTML syntax is highlighted outside of the PHP tags
* PHP tags are purple
* Comments are dark blue
* Known functions are turquoise
L Function parameters are white, unless they are quoted
or variables
* Variables are turquoise, with a bronze $
* Quoted strings are red
* Operators are bronze
* Custom functions are white with purple parentheses
* HEREDOC is white, with the exception of variables (as described above)

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[PHP] vim/php color scheme

2007-12-27 Thread OOzy Pal
Anyone have a nice color scheme for php syntax highlighting in vim? I
am using elflord and it is nice but the comment color is like the
function color which makes it confusing.


-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread Nathan Nobbe
On Dec 27, 2007 11:00 AM, OOzy Pal [EMAIL PROTECTED] wrote:

 Anyone have a nice color scheme for php syntax highlighting in vim? I
 am using elflord and it is nice but the comment color is like the
 function color which makes it confusing.


torte is my favorite; w/ a dark background.
murphy is runner up (also w/ dark bg).

-nathan


Re: [PHP] control browser with a href tag

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 9:50 AM, Hiep Nguyen [EMAIL PROTECTED] wrote:
 if user clicks on the hyperlink on list.php page, i want to open a new
 windows for user to update info.  once user clicks update on update.php
 page, i want to close the update.php page automatically and refresh list.php
 page.  i think this is possible.  can someone give me suggestions how to do
 this?

Yes.  Ask on a JavaScript list.  Anything like that is done on the
client side (in the browser), which would be handled by JavaScript,
VBScript, or something similar - not PHP.  PHP only handles the server
side of things, before the HTML (or other content) is even passed
through Apache (or whatever HTTP server is running) to serve to the
client.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 11:31 AM, Albert Wiersch [EMAIL PROTECTED] wrote:

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly
 often) failing to open some URLs that users have entered. fopen() returns
 false very quickly, but when tried again with the same URL, sometimes it
 works. What would cause this behavior? Why does fopen() occasionally fail to
 open valid http addresses but works at other times?

Are the URLs being passed to fopen() properly escaped?  Are they
valid, complete with http:// placed before the domain?  Try keeping a
log of all URLs entered for a bit, and see which ones fail.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
often) failing to open some URLs that users have entered. fopen() returns 
false very quickly, but when tried again with the same URL, sometimes it 
works. What would cause this behavior? Why does fopen() occasionally fail to 
open valid http addresses but works at other times?

-- 
Albert Wiersch

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread OOzy Pal
On Dec 27, 2007 7:09 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Dec 27, 2007 11:00 AM, OOzy Pal [EMAIL PROTECTED] wrote:
  Anyone have a nice color scheme for php syntax highlighting in vim? I
  am using elflord and it is nice but the comment color is like the
  function color which makes it confusing.

 I do all of my coding in ViM, and I just use the default colors.
 The basic scheme is like this:
 * HTML syntax is highlighted outside of the PHP tags
 * PHP tags are purple
 * Comments are dark blue
 * Known functions are turquoise
 L Function parameters are white, unless they are quoted
 or variables
 * Variables are turquoise, with a bronze $
 * Quoted strings are red
 * Operators are bronze
 * Custom functions are white with purple parentheses
 * HEREDOC is white, with the exception of variables (as described 
 above)

 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.


How can I edit these .vim files to tweak colors. Where are colors defined?

-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread Nathan Nobbe
if you want to try out all the colorschemes on your system you can
do so pretty quickly and easily, with the following keystrokes:

   1. Esc
   2. (type) :colorscheme
   3. space
   4. tab through the available colorschemes

-nathan


Re: [PHP] vim/php color scheme

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 12:02 PM, OOzy Pal [EMAIL PROTECTED] wrote:
 How can I edit these .vim files to tweak colors. Where are colors defined?

[This example assumes your version is 6.3 and it's a default
installation.  YMMV. -DPB]

Color schemes and themes are in:
/usr/share/vim/vim63/colors/

Syntax highlighting definition files are in:
/usr/share/vim/vim63/syntax/

To edit the PHP syntax highlighting definition file, open:
/usr/share/vim/vim63/syntax/php.vim

In there, you'll find lines such as this:
syn keyword phpFunctionsutf8_decode utf8_encode
xml_error_string xml_get_current_byte_index
xml_get_current_column_number xml_get_current_line_number
xml_get_error_code xml_parse_into_struct xml_parse
xml_parser_create_ns xml_parser_create xml_parser_free
xml_parser_get_option xml_parser_set_option
xml_set_character_data_handler xml_set_default_handler
xml_set_element_handler xml_set_end_namespace_decl_handler
xml_set_external_entity_ref_handler xml_set_notation_decl_handler
xml_set_object xml_set_processing_instruction_handler
xml_set_start_namespace_decl_handler
xml_set_unparsed_entity_decl_handler contained

Those define how each string (keyword) should be classified.  In
the above example, `xml_parso_into_struct` would be classified as
`phpFunctions`.  Further down, you'll see lines like these:

HiLink phpStringDoubleString
HiLink phpNumber  Number
HiLink phpFloat   Float
HiLink phpMethods Function
HiLink phpFunctions   Function
HiLink phpBaselib Function

Notice that `phpFunctions` is an alias to `Function`.

Now check through the files in the themes directory, and you'll
see that (some) have colors and styles defined for Function (some are
re-aliased as `Identifier`, if memory serves correctly).  Take a few
hints from those files, and you should be able to write your own from
scratch.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Dec 27, 2007 11:31 AM, Albert Wiersch [EMAIL PROTECTED] 
 wrote:

Are the URLs being passed to fopen() properly escaped?  Are they
 valid, complete with http:// placed before the domain?  Try keeping a
 log of all URLs entered for a bit, and see which ones fail.

It's not the URL because the same URL will not work one time but will work 
another time.

What needs to be escaped for a URL anyway? I am just changing spaces to 
'%20' now.

I will try upgrading to 5.2.5. I'm using 5.2.3 now.

Thanks,
Albert

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



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Some additional info. It seems I am getting these warnings when it fails:

Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo 
failed: Name or service not known

Warning: fopen(http://wanganda2u.co.uk) [function.fopen]: failed to open 
stream:

Now I have to find out why that is failing some of the time but not other 
times.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

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



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 1:00 PM, Albert Wiersch [EMAIL PROTECTED] wrote:

 Some additional info. It seems I am getting these warnings when it fails:

 Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo
 failed: Name or service not known

That sounds like a DNS resolution error.  If you have Telnet/SSH
or local console access, try doing a dig, traceroute, and ping series
on it.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 12:57 PM, Albert Wiersch [EMAIL PROTECTED] wrote:
 What needs to be escaped for a URL anyway? I am just changing spaces to
 '%20' now.

Arbitrary code can still be injected unless it's properly
sanitized, but that's beyond the scope here.

Mainly, make sure quotes (single and double) are being converted.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread OOzy Pal
Daniel,

Sweet! Mine is version 7.x but I got it. I will check under vim7x. I
post if I have further questions.

Thank you

On Dec 27, 2007 8:20 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Dec 27, 2007 12:02 PM, OOzy Pal [EMAIL PROTECTED] wrote:
  How can I edit these .vim files to tweak colors. Where are colors defined?

 [This example assumes your version is 6.3 and it's a default
 installation.  YMMV. -DPB]

 Color schemes and themes are in:
 /usr/share/vim/vim63/colors/

 Syntax highlighting definition files are in:
 /usr/share/vim/vim63/syntax/

 To edit the PHP syntax highlighting definition file, open:
 /usr/share/vim/vim63/syntax/php.vim

 In there, you'll find lines such as this:
 syn keyword phpFunctionsutf8_decode utf8_encode
 xml_error_string xml_get_current_byte_index
 xml_get_current_column_number xml_get_current_line_number
 xml_get_error_code xml_parse_into_struct xml_parse
 xml_parser_create_ns xml_parser_create xml_parser_free
 xml_parser_get_option xml_parser_set_option
 xml_set_character_data_handler xml_set_default_handler
 xml_set_element_handler xml_set_end_namespace_decl_handler
 xml_set_external_entity_ref_handler xml_set_notation_decl_handler
 xml_set_object xml_set_processing_instruction_handler
 xml_set_start_namespace_decl_handler
 xml_set_unparsed_entity_decl_handler contained

 Those define how each string (keyword) should be classified.  In
 the above example, `xml_parso_into_struct` would be classified as
 `phpFunctions`.  Further down, you'll see lines like these:

 HiLink phpStringDoubleString
 HiLink phpNumber  Number
 HiLink phpFloat   Float
 HiLink phpMethods Function
 HiLink phpFunctions   Function
 HiLink phpBaselib Function

 Notice that `phpFunctions` is an alias to `Function`.

 Now check through the files in the themes directory, and you'll
 see that (some) have colors and styles defined for Function (some are
 re-aliased as `Identifier`, if memory serves correctly).  Take a few
 hints from those files, and you should be able to write your own from
 scratch.

 --

 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.




-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread OOzy Pal
On Dec 27, 2007 10:32 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Dec 27, 2007 2:27 PM, OOzy Pal [EMAIL PROTECTED] wrote:
  Daniel,
 
  Sweet! Mine is version 7.x but I got it. I will check under vim7x. I
  post if I have further questions.
 
  Thank you

 You're welcome, but try to keep non-PHP-related questions on their
 respective lists.  This one is really only for PHP questions, I just
 thought that particular question and answer would benefit the PHP
 developer community in the archives.

 --

 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.


Sure.

Sorry for mixing up things.

-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 2:27 PM, OOzy Pal [EMAIL PROTECTED] wrote:
 Daniel,

 Sweet! Mine is version 7.x but I got it. I will check under vim7x. I
 post if I have further questions.

 Thank you

You're welcome, but try to keep non-PHP-related questions on their
respective lists.  This one is really only for PHP questions, I just
thought that particular question and answer would benefit the PHP
developer community in the archives.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

That sounds like a DNS resolution error.  If you have Telnet/SSH
 or local console access, try doing a dig, traceroute, and ping series
 on it.

Hi Daniel,

Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
have addressed this issue though. If not, then I'll concentrate on a 
possible DNS resolution problem.

Albert

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



[PHP] socket_read can not read the whole HTTP page?

2007-12-27 Thread ked
I wrote those script  to get HTTP url content, and it  works , but it can't
read the whole content of the page.
Blocked on while ($out = socket_read($socket, 1024)) .
 browser show the processbar all the time , and the page is not completed
display,

If I press ESC key to cancel the request , the resource of page show that :
the target URL were not read completed .
next codes  never been executed .

Why  socket_read blocked? 
Additional : The network and  URL are absolute valid all the time . the size
of  target  page is about 30k bits .

script : 
? 
header(Content-type: text/html; charset=UTF-8);
error_reporting(E_ALL);
 
echo h2TCP/IP Connection/h2\npre;
 
$service_port = 80; 
$host  = 10.1.1.144;
$file  = /index.aspx;
$address = gethostbyname('10.1.1.144');
 
/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket  0) 
{
   echo socket_create() failed.\n reason:  . socket_strerror($socket) .
\n;
} else 
{
   echo OK.\n;
}
 
echo try connect to  '$address' : '$service_port'...;
$result = socket_connect($socket, $address, $service_port);
if ($result  0) 
{
   echo socket_connect() failed.\n reason: ($result)  .
socket_strerror($result) . \n;
} else {
   echo OK.\n;
}
 
//$in = HEAD / HTTP/1.1\r\n;
$in = '';
 
$in .= GET {$file} HTTP/1.1\r\n;
$in .= Accept: text/html\r\n;
$in .= Accept-Language: zh-cn\r\n;
//$in .= Accept-Encoding: gzip, deflate\r\n;
$in .= User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET
CLR 2.0.50727)\r\n;
$in .= Host: {$host}\r\n;
$in .= Cache-Control: no-cache\r\n;
$in .= Connection: Keep-Alive\r\n\r\n;
 
echo send HTTP HEAD request...\n{$in};
socket_write($socket, $in, strlen($in));
echo OK.\n;
 

echo read response:---\n\ntextarea;
$len = 0;
$out= '';
while ($out = socket_read($socket, 1024)) //
---wait for too long time .!
{
 $len += strlen($out);  
 echo $out; 
}
echo /textarea;
 
 
echo close socket ...;
socket_close($socket);
echo OK.\n\n;
?

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



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
 have addressed this issue though. If not, then I'll concentrate on a 
 possible DNS resolution problem.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Albert

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



Re: [PHP] vim/php color scheme

2007-12-27 Thread Nathan Nobbe
On Dec 27, 2007 2:32 PM, Daniel Brown [EMAIL PROTECTED] wrote:

 On Dec 27, 2007 2:27 PM, OOzy Pal [EMAIL PROTECTED] wrote:
  Daniel,
 
  Sweet! Mine is version 7.x but I got it. I will check under vim7x. I
  post if I have further questions.
 
  Thank you

You're welcome, but try to keep non-PHP-related questions on their
 respective lists.  This one is really only for PHP questions, I just
 thought that particular question and answer would benefit the PHP
 developer community in the archives.


bagh!  i have enough trouble copying my .vimrc from box to box let alone
bothering to customize a colorscheme and port that as well.  find a
colorscheme
you like, drop it in .vimrc and be done w/ it.
hows that for the developer community archives :)

-nathan


Re: [PHP] socket_read can not read the whole HTTP page?

2007-12-27 Thread Eddie Dunckley
On Fri 28 Dec 07, ked wrote:
 I wrote those script  to get HTTP url content, and it  works , but it
 can't read the whole content of the page.
 Blocked on while ($out = socket_read($socket, 1024)) .
 $in .= GET {$file} HTTP/1.1\r\n;
try to change this to $in .= GET {$file} HTTP/1.0\r\n;

 $in .= Connection: Keep-Alive\r\n\r\n;
and change this to 
$in .= Connection: closed\r\n\r\n;

-- 
Eddie Dunckley - [EMAIL PROTECTED] - Realtime Travel Connections 
IBE Development, www.rttc.co.za, cell 083-379-6891, fax 086-617-7831
Where 33deg53'37.23S 18deg37'57.87E Cape Town Bellville Oakdale ZA
   Chaos, panic, and disorder - my work here is done.

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



Re: [PHP] socket_read can not read the whole HTTP page?

2007-12-27 Thread Eddie Dunckley
On Fri 28 Dec 07, Eddie Dunckley wrote:
 On Fri 28 Dec 07, ked wrote:
  I wrote those script  to get HTTP url content, and it  works , but
 and change this to
 $in .= Connection: closed\r\n\r\n;
soz that should be close not closed;

-- 
Eddie - Chaos, panic, and disorder - my work here is done.

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