php-general Digest 5 Feb 2010 10:33:54 -0000 Issue 6574
Topics (messages 301814 through 301826):
CLI behind proxy
301814 by: kranthi
301815 by: Richard Quadling
301816 by: kranthi
301817 by: Richard Quadling
301818 by: Richard Quadling
301820 by: kranthi
301821 by: Richard Quadling
Re: stream_select() not working on regular files?
301819 by: Nathan Rixham
HTML & plain text in Outlook 2007
301822 by: Skip Evans
301823 by: Ashley Sheridan
301824 by: Robert Cummings
301825 by: Ashley Sheridan
301826 by: Richard Quadling
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 ---
Hi all,
I want to run fsockopen etc behind a proxy.
proxychains (http://proxychains.sourceforge.net/) may be helpful,
unfortunately the support for that is pretty bad. Please inform me of other
alternatives
KK.
--- End Message ---
--- Begin Message ---
On 4 February 2010 12:48, kranthi <[email protected]> wrote:
> Hi all,
>
> I want to run fsockopen etc behind a proxy.
> proxychains (http://proxychains.sourceforge.net/) may be helpful,
> unfortunately the support for that is pretty bad. Please inform me of other
> alternatives
>
> KK.
>
I used to use a proxy written in Python which provided the client NTLM
authentication to our ISA server for PHP.
So, PHP script talked to NTLM Authentication Proxy Server which talked
to ISA which talked to the outside world.
Worked fine.
The only thing I needed to do in PHP was setup a default context and
all my normal file_get_contents(),etc. which needed to communicate
through to the outside world worked fine.
Here is the code I used ...
// Define the default, system-wide context.
$r_default_context = stream_context_get_default
(
array
(
'http' => array
( // All HTTP requests are passed through the local
NTLM proxy
server on port 8080.
'proxy' => 'tcp://127.0.0.1:8080',
'request_fulluri' => True,
),
)
);
// Though we said system wide, some extensions need a little coaxing.
libxml_set_streams_context($r_default_context);
So, set the proxy tcp address appropriately, put this code in a global
include file (maybe via the auto_prepend_file= ini file setting) and
see how you go.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
I did'nt understand completely. But I noticed that if i do
$opts = array('http' => array('proxy' => 'tcp://10.3.100.212:8080',
'request_fulluri' => true));
$context = stream_context_set_default($opts);
fopen, file_get_contents, etc. are working fine, but fsockopen is not
KK.
--- End Message ---
--- Begin Message ---
On 4 February 2010 14:19, kranthi <[email protected]> wrote:
> fsockopen
What type of socket are you opening?
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
On 4 February 2010 14:38, Richard Quadling <[email protected]> wrote:
> On 4 February 2010 14:19, kranthi <[email protected]> wrote:
>> fsockopen
>
> What type of socket are you opening?
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
The code puts HTTP requests through the context.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
stream_socket_client("tcp://talk.google.com:5222")
i m trying to use http://code.google.com/p/xmpphp/ actually
--- End Message ---
--- Begin Message ---
On 4 February 2010 15:27, kranthi <[email protected]> wrote:
> stream_socket_client("tcp://talk.google.com:5222")
> i m trying to use http://code.google.com/p/xmpphp/ actually
>
Does your proxy pass through all requests?
It might be easier to just set you NIC gateway to the proxy.
We stopped using ISA server with NTLM authentication.
Now, the gateway for my machine is the ISA server, so all requests go
through there automatically and we use AD for authentication.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Dennis J. wrote:
> The issue is that once I've hit the EOF I need to continue the loop
> using the stream_select() waiting for new data.
AFAIK you can't; you see stream_select checks to see if something will
be blocked; if EOF is reached it considers this as not blocked; in other
words the second you hit a file EOF stream_select will continue to
instantly return a positive (without the wait of 1 second).
As far as I know every related function will always return the second
EOF is hit; meaning that the -f functionality you want can only be
gained by adding in the sleep (but i think every line reading function
will still instantly return with an empty line) - so maybe you just need
to proc_open to tail -f and read the stream with PHP - as it won't send
an EOF - example:
<?php
$stream = popen( 'tail -f access.log' , 'r' );
while( $line = fgets($stream) ) {
echo $line;
}
pclose( $stream ); // won't get here unless an error i guess..
good luck!
Nathan
--- End Message ---
--- Begin Message ---
Hey all,
First, let me say thanks for all the advice on Magento, and
especially to Ryan who has used the beast and gave some great
advice on skinning, links to some good docs and a book just
for my designer. We'll be using and I'm looking forward to
learning it.
But anyway...
I'm doing some maintenance work on a system that sends an
email message using the multi-part boundaries to include both
a plain text version and an HTML version of an email.
I've read up on this before, but never actually done it. So
implementing the code was not a big issue, and in fact it
works perfectly when tested on my Ubuntu machine using
Thunderbird to test the HTML and Evolution to test the plain
text version. In fact, I can switch formats on both of these
and all looks great.
Enter Microsoft (Insert opening of Bach's Toccata and Fugue in
D minor to send chills up my readers' spines.)
On Outlook 2007 in HTML mode it renders, how can I put this...
half-assedly. In text mode the whole things a bust. There is
the HTML code all stuffed up at the top, boundary codes are
visible, just plain awful.
Googling around I see articles from 2007 when that version of
Outlook came out lamenting the fact that MS pulled the IE
rendering engine from it and replaced it with MS Word's
renderer to plug security holes expoitable via email.
Does anyone have any experience with HTML & plain text
multi-part messages and Outlook 2007, or any tips how I can
get this working? Still Googling, but any tips would be
greatly appreciated.
Skip
--
====================================
Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--- End Message ---
--- Begin Message ---
On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote:
> Hey all,
>
> First, let me say thanks for all the advice on Magento, and
> especially to Ryan who has used the beast and gave some great
> advice on skinning, links to some good docs and a book just
> for my designer. We'll be using and I'm looking forward to
> learning it.
>
> But anyway...
>
> I'm doing some maintenance work on a system that sends an
> email message using the multi-part boundaries to include both
> a plain text version and an HTML version of an email.
>
> I've read up on this before, but never actually done it. So
> implementing the code was not a big issue, and in fact it
> works perfectly when tested on my Ubuntu machine using
> Thunderbird to test the HTML and Evolution to test the plain
> text version. In fact, I can switch formats on both of these
> and all looks great.
>
> Enter Microsoft (Insert opening of Bach's Toccata and Fugue in
> D minor to send chills up my readers' spines.)
>
> On Outlook 2007 in HTML mode it renders, how can I put this...
> half-assedly. In text mode the whole things a bust. There is
> the HTML code all stuffed up at the top, boundary codes are
> visible, just plain awful.
>
> Googling around I see articles from 2007 when that version of
> Outlook came out lamenting the fact that MS pulled the IE
> rendering engine from it and replaced it with MS Word's
> renderer to plug security holes expoitable via email.
>
> Does anyone have any experience with HTML & plain text
> multi-part messages and Outlook 2007, or any tips how I can
> get this working? Still Googling, but any tips would be
> greatly appreciated.
>
> Skip
> --
> ====================================
> Skip Evans
> PenguinSites.com, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://penguinsites.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
What about signing yourself up to some newsletters to see how they do
it?
Looking at the ones I get from Facebook as an example, they use the
boundary codes you mentioned, and I can't see anything particularly
special that's been added. What order are you sending the two message
parts by the way? I think the traditional way is to send the plain/text
part first, so that UA's that don't understand or support multipart
messages only use the first one. As you mentioned that you're seeing
HTML code at the top, I'd hazard a guess that you're sending the HTML
first?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote:
Hey all,
First, let me say thanks for all the advice on Magento, and
especially to Ryan who has used the beast and gave some great
advice on skinning, links to some good docs and a book just
for my designer. We'll be using and I'm looking forward to
learning it.
But anyway...
I'm doing some maintenance work on a system that sends an
email message using the multi-part boundaries to include both
a plain text version and an HTML version of an email.
I've read up on this before, but never actually done it. So
implementing the code was not a big issue, and in fact it
works perfectly when tested on my Ubuntu machine using
Thunderbird to test the HTML and Evolution to test the plain
text version. In fact, I can switch formats on both of these
and all looks great.
Enter Microsoft (Insert opening of Bach's Toccata and Fugue in
D minor to send chills up my readers' spines.)
On Outlook 2007 in HTML mode it renders, how can I put this...
half-assedly. In text mode the whole things a bust. There is
the HTML code all stuffed up at the top, boundary codes are
visible, just plain awful.
Googling around I see articles from 2007 when that version of
Outlook came out lamenting the fact that MS pulled the IE
rendering engine from it and replaced it with MS Word's
renderer to plug security holes expoitable via email.
Does anyone have any experience with HTML & plain text
multi-part messages and Outlook 2007, or any tips how I can
get this working? Still Googling, but any tips would be
greatly appreciated.
Skip
--
====================================
Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
What about signing yourself up to some newsletters to see how they do
it?
Looking at the ones I get from Facebook as an example, they use the
boundary codes you mentioned, and I can't see anything particularly
special that's been added. What order are you sending the two message
parts by the way? I think the traditional way is to send the plain/text
part first, so that UA's that don't understand or support multipart
messages only use the first one. As you mentioned that you're seeing
HTML code at the top, I'd hazard a guess that you're sending the HTML
first?
The problem is most likely NOT his email structure, but the fact that
Microsoft in all their lock-in, make things difficult, non standard,
monopolistic philosophy chose to switch out the IE HTML renderer (which
was getting pretty decent with IE7 and IE8) with the Office HTML
renderer... so now basic things like CSS padding of something as simple
as a <p> tag is not possible. You now need to use margins instead. The
full list of supported attributes / CSS can be found here:
http://msdn.microsoft.com/en-us/library/aa338201.aspx
Obviously creating HTML emails was getting too easy (like it is with
Thunderbird). Of course... I guess it could be as bad as Google
stripping out the stylesheets entirely when viewing HTML content which
forces you to put the styles on the tags themselves.
... actually I'm not sure what's worse... at least you can use standard
styles with Google's gmail. Either way... making nice looking HTML
emails that work across Outlook, Thunderbird, Gmail, Yahoo, and Hotmail
is a pain in the ass.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
On Thu, 2010-02-04 at 13:44 -0500, Robert Cummings wrote:
> Ashley Sheridan wrote:
> > On Thu, 2010-02-04 at 10:44 -0600, Skip Evans wrote:
> >
> >> Hey all,
> >>
> >> First, let me say thanks for all the advice on Magento, and
> >> especially to Ryan who has used the beast and gave some great
> >> advice on skinning, links to some good docs and a book just
> >> for my designer. We'll be using and I'm looking forward to
> >> learning it.
> >>
> >> But anyway...
> >>
> >> I'm doing some maintenance work on a system that sends an
> >> email message using the multi-part boundaries to include both
> >> a plain text version and an HTML version of an email.
> >>
> >> I've read up on this before, but never actually done it. So
> >> implementing the code was not a big issue, and in fact it
> >> works perfectly when tested on my Ubuntu machine using
> >> Thunderbird to test the HTML and Evolution to test the plain
> >> text version. In fact, I can switch formats on both of these
> >> and all looks great.
> >>
> >> Enter Microsoft (Insert opening of Bach's Toccata and Fugue in
> >> D minor to send chills up my readers' spines.)
> >>
> >> On Outlook 2007 in HTML mode it renders, how can I put this...
> >> half-assedly. In text mode the whole things a bust. There is
> >> the HTML code all stuffed up at the top, boundary codes are
> >> visible, just plain awful.
> >>
> >> Googling around I see articles from 2007 when that version of
> >> Outlook came out lamenting the fact that MS pulled the IE
> >> rendering engine from it and replaced it with MS Word's
> >> renderer to plug security holes expoitable via email.
> >>
> >> Does anyone have any experience with HTML & plain text
> >> multi-part messages and Outlook 2007, or any tips how I can
> >> get this working? Still Googling, but any tips would be
> >> greatly appreciated.
> >>
> >> Skip
> >> --
> >> ====================================
> >> Skip Evans
> >> PenguinSites.com, LLC
> >> 503 S Baldwin St, #1
> >> Madison WI 53703
> >> 608.250.2720
> >> http://penguinsites.com
> >> ------------------------------------
> >> Those of you who believe in
> >> telekinesis, raise my hand.
> >> -- Kurt Vonnegut
> >>
> >
> >
> > What about signing yourself up to some newsletters to see how they do
> > it?
> >
> > Looking at the ones I get from Facebook as an example, they use the
> > boundary codes you mentioned, and I can't see anything particularly
> > special that's been added. What order are you sending the two message
> > parts by the way? I think the traditional way is to send the plain/text
> > part first, so that UA's that don't understand or support multipart
> > messages only use the first one. As you mentioned that you're seeing
> > HTML code at the top, I'd hazard a guess that you're sending the HTML
> > first?
>
> The problem is most likely NOT his email structure, but the fact that
> Microsoft in all their lock-in, make things difficult, non standard,
> monopolistic philosophy chose to switch out the IE HTML renderer (which
> was getting pretty decent with IE7 and IE8) with the Office HTML
> renderer... so now basic things like CSS padding of something as simple
> as a <p> tag is not possible. You now need to use margins instead. The
> full list of supported attributes / CSS can be found here:
>
> http://msdn.microsoft.com/en-us/library/aa338201.aspx
>
> Obviously creating HTML emails was getting too easy (like it is with
> Thunderbird). Of course... I guess it could be as bad as Google
> stripping out the stylesheets entirely when viewing HTML content which
> forces you to put the styles on the tags themselves.
>
> ... actually I'm not sure what's worse... at least you can use standard
> styles with Google's gmail. Either way... making nice looking HTML
> emails that work across Outlook, Thunderbird, Gmail, Yahoo, and Hotmail
> is a pain in the ass.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
If he's getting HTML output at the top of the email, I would think that
did suggest that MS Word didn't like the structure. Making HTML emails
is now such a difficult job, as the email clients rendering engines tend
to not get updated as often as browsers, and there doesn't seem to be
any effort in bringing the rendering of the email clients together.
Whenever I create these emails I try to make sure I try no to get too
creative in the design, and use not only CSS styles, but properties of
the HTML tags themselves. It means I end up writing the CSS essentially
twice and backing it up with old deprecated HTML attributes, but it
usually does the trick.
Is there any effort by some standards group that email clients could
benefit from?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On 4 February 2010 16:44, Skip Evans <[email protected]> wrote:
> Hey all,
>
> First, let me say thanks for all the advice on Magento, and especially to
> Ryan who has used the beast and gave some great advice on skinning, links to
> some good docs and a book just for my designer. We'll be using and I'm
> looking forward to learning it.
>
> But anyway...
>
> I'm doing some maintenance work on a system that sends an email message
> using the multi-part boundaries to include both a plain text version and an
> HTML version of an email.
>
> I've read up on this before, but never actually done it. So implementing the
> code was not a big issue, and in fact it works perfectly when tested on my
> Ubuntu machine using Thunderbird to test the HTML and Evolution to test the
> plain text version. In fact, I can switch formats on both of these and all
> looks great.
>
> Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to
> send chills up my readers' spines.)
>
> On Outlook 2007 in HTML mode it renders, how can I put this... half-assedly.
> In text mode the whole things a bust. There is the HTML code all stuffed up
> at the top, boundary codes are visible, just plain awful.
>
> Googling around I see articles from 2007 when that version of Outlook came
> out lamenting the fact that MS pulled the IE rendering engine from it and
> replaced it with MS Word's renderer to plug security holes expoitable via
> email.
>
> Does anyone have any experience with HTML & plain text multi-part messages
> and Outlook 2007, or any tips how I can get this working? Still Googling,
> but any tips would be greatly appreciated.
>
> Skip
> --
> ====================================
> Skip Evans
> PenguinSites.com, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://penguinsites.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I create HTML.Mime based emails in PHP with a plain text part which is
basically a cop out saying that they should upgrade.
The HTML part is a fax form. They print it out, add some stickers
relating to work carried out and then fax it back (or email it as a
TIFF or PDF if they have the skills/tech to do that).
I use Outlook 2003 (work) and GMail via Chrome (personal).
The form includes embedded images (essentially their logo as the forms
are passed to their clients) and have a PDF attached ( a report from
our systems about the email they are receiving).
All fairly simple.
1 - Plain Text - (Please upgrade)
2 - Alternative HTML
3 - Embedded images
4 - Attachment
For this, I use RMail from phpguru.org (previously known as
html_mime_mail5) http://www.phpguru.org/static/Rmail
The HTML I used contains limited CSS and is table based.
I initially did it "properly", or so I thought.
I'd used IE7/FireFox/Safari/Opera as a test of a proper HTML page with
CSS to produce a nice looking form. Scaled nicely, limited shrink,
etc.
Looked OK in Outlook 2003 too!
But when I sent them for approval to the line manager, who uses
Outlook 2007, well, let's just say he didn't understand the form at
all!
Even when I redid it with tables, I'd used <thead>, <tfoot>, <tbody>
(proper HTML at least). In O2K7? It renders in order - header, footer,
body. Great!
So, the HTML I ended up with REALLY looks like something from when I
was first learning HTML (I just worked it out as being 13 years ago!).
So, yes. The code is horribly old fashioned. But it works.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---