[PHP] SSL POST problems, cURL, fsockopen, ipv6??

2003-07-05 Thread af
Hello.

I've read all the documentation I can find about https POSTs using curl, fsockopen 
with ssl://,
even PEAR's Net_Socket package, but I'm running into a PHP problem I haven't seen 
before.

Platform Info:
OpenBSD 2.9, PHP 4.3.2, Apache 1.3.27, ModSSL 2.8.14, OpenSSL 0.9.6, curl 7.9.8
(I've installed curl 7.10.5, but PHP configure refuses to see it even when I specify 
the path,
--with-curl=/usr/local/curl -- it uses the default 7.9.8 install in /usr/local no 
matter what I
do).

I'm testing all my code on my Mac OS X server and everything works fine, but I'm 
running into
problems when I try to move it to my main server running OpenBSD 2.9 -- I can't get 
any of these
methods to connect to a particular target server (running MS Site Server, btw) -- all 
attempts
return nothing.  Yes, I'm also talking to the admins of the target server, but some 
error
messages on my end concern me.

 - Using Snoopy (which uses curl for https posts), it reports an error 6 = Couldn't 
resolve
host.

 - Using fsockopen with ssl://, my error log reads:
   PHP Warning:  fsockopen(): unable to connect to [secure.host.name]:443
PHP Warning:  fsockopen(): php_network_getaddresses: getaddrinfo failed: no address
associated with name (is your IPV6 configuration correct? If this error happens all 
the time, try
reconfiguring PHP using --disable-ipv6 option to configure)

(I've tried reconfiguring php with --disable-ipv6 and reinstalling, but I continue 
to get the
same message).

Anyone have any penetrating insights?
Thanks in advance...
Alex
- - - - - - - - - -
af at ax-im dot com

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



[PHP] Anyone?? file uploads received, but mangled

2003-01-27 Thread af
Hi all.

Last try -- I know there's a lot of noise in this group, but could someone please 
offer an opinion?

Is the following possible to work around, or is it a bug that I should be reporting?

I'm having issues uploading files whose names don't necessarily end with the correct 
extension, in particular plain text files which don't end in .txt.  (Why they don't is 
complicated, and it's impractical to insist that they must.)  The files are received, 
but altered -- they are prepended with garbage data which makes them difficult to deal 
with in an elegant automated way, which is the whole point.

No doubt this is a mime type issue, as the files are received as type 
application/x-macbinary when sent from OSX IE (its best guess, I suppose).  Is there 
any way to force plain text, or raw data?  All I want to happen is for the files to be 
uploaded completely unchanged.

Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on 
OpenBSD.

Thanks,
Alex
[EMAIL PROTECTED]

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




RE: [PHP] Anyone?? file uploads received, but mangled

2003-01-27 Thread af
I don't believe it -- it's another IE feature!!  It doesn't happen in Netscape 7.  
Not completely sure, but I think the binary data is the mac-specific type/creator code 
which apparently IE feels the need to prepend.  I thought I was safe now that I've 
dumped OS 9 entirely and moved everything to OS X, but I guess not.

Btw, I finally figured out a way of stripping the binary data with a regexp (after 
struggling for a while before discovering that fgets is not binary safe!), but still, 
it's a hack that I'd rather not have to use.  Honestly, Microsoft is the bane of my 
existence.  Every time it tries to help, it gets it wrong.

Thanks to everyone for the suggestions.  Sometimes the eyes blur and the mind freezes 
over at times like these, and it takes external input to get un-frozen.

Cheers...
Alex
[EMAIL PROTECTED]



 Are you using Apache 2?
 
 ---John W. Holmes...




  Last try -- I know there's a lot of noise in this group, but could someone
  please offer an opinion?
  
  Is the following possible to work around, or is it a bug that I should be
  reporting?
  
  I'm having issues uploading files whose names don't necessarily end with
  the correct extension, in particular plain text files which don't end in
  .txt.  (Why they don't is complicated, and it's impractical to insist that
  they must.)  The files are received, but altered -- they are prepended
  with garbage data which makes them difficult to deal with in an elegant
  automated way, which is the whole point.
  
  No doubt this is a mime type issue, as the files are received as type
  application/x-macbinary when sent from OSX IE (its best guess, I
  suppose).  Is there any way to force plain text, or raw data?  All I want
  to happen is for the files to be uploaded completely unchanged.
  
  Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest
  4.3 on OpenBSD.


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




Re: [PHP] Disable pic copy/save?

2003-01-23 Thread af
Not true -- you can use JavaScript to catch right-click events and do something 
creative with them, or disable them entirely.

But that, of course, is a client-side scripting issue, which has nothing to do with 
server-side languages such as PHP.

Cheers,
Alex



 On Thursday 23 January 2003 17:52, Anthony Rodriguez wrote:

  Hi!
 
  A client wants to test market two versions of an advertising but wants to
  disable the users' ability to copy/save the ads (right click, copy/save).
 
  How can this be done in PHP?
 
 It can't be done, period. You need to get the data to the browser for it to be 
 displayed. Once it's on the user's browser a determined user will be able to 
 save whatever it is that's being displayed.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 It is wrong always, everywhere and for everyone to believe anything upon
 insufficient evidence.
 - W. K. Clifford, British philosopher, circa 1876
 */

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




Re: [PHP] HELP: Regex pattern matching

2003-01-23 Thread af
Hmmm... I was about to reply with a simple solution, but there's a problem with it 
that I can't explain.  Assuming the text is in $str...

I can't get preg_replace to match a newline at the end of a pattern.  If I use...

 $str = preg_replace('/\n=.+--\n/sU', '', $str);

...it matches nothing, but if I put a tag character at the end of the dashes, e.g.

x

...then use...
 
 $str = preg_replace('/\n=.+--x/sU', '', $str);

...it works perfectly.  I'm not sure why the pattern doesn't care about the first 
newline, but it chokes on the second one.  Any thoughts?

Thanks,
Alex



 I have an ASCII file which has multiple blocks of text I want to clear. The
 scheme is as follows:
 
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 line 1 Everything between the separators,
 line 2 including the separators
 line 3 I want to clear from the text file
 line 4
 -
 
 This text I want to keep
 
 There are infinite number of blocks surrounded by exactly the same
 separators.
 So, I guess I need to clear everything between the starting = and the
 ending -.
 
 Can anyone suggest a regex pattern string that would help me accomplish
 that?
 
 Thank you all guys in advance!
 
 Nasko

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




[PHP] file uploads received, but mangled

2003-01-21 Thread af
Hi all.

2nd try -- Is the following possible to work around, or is it a bug that I should be 
reporting?

I'm having issues uploading files whose names don't necessarily end with the correct 
extension, in particular text files which don't end in .txt.  (Why they don't is 
complicated, and it's impractical to insist that they must.)  The files are received, 
but altered -- they are prepended with binary data which makes them difficult to deal 
with in an elegant automated way.

No doubt this is a mime type issue, as the files are received as type 
application/x-macbinary when sent from OSX Explorer.  Is there any way to force 
plain text, or raw data?  All I want to happen is for the files to be uploaded 
completely unchanged.

Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on 
OpenBSD.

Thanks,
Alex
[EMAIL PROTECTED]

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




[PHP] file uploads received, but mangled

2003-01-20 Thread af
Hi all.

I'm having issues uploading files whose names don't necessarily end with the correct 
extension, in particular text files which don't end in .txt.  (Why they don't is 
complicated, and it's impractical to insist that they must.)  The files are received, 
but altered -- they are prepended with binary data which makes them difficult to deal 
with in an elegant automated way.

No doubt this is a mime type issue, as the files are received as type 
application/x-macbinary when sent from OSX Explorer.  Is there any way to force 
plain text, or raw data?  All I want to happen is for the files to be uploaded 
completely unchanged.

Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on 
OpenBSD.

Thanks,
Alex
[EMAIL PROTECTED]

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




[PHP] Reg exp to remove line feeds before lines starting with white space

2002-07-25 Thread Nicklas af Ekenstam

Hi

I'm trying to do some parsing of mail headers and since not all
headers follow the pattern:

X-Header-A: A string
X-Header-B: Another string that is longer
X-Header-C: And this string is very very long compared

But may very well look like this:

X-Header-A: A string
X-Header-B: Another string that is 
 longer
X-Header-C: And this string is very very long 
compared

(Note that two of the header lines above wrap more than one line.)

In order to read the headers into an array of header key/value fields
i would like a reg exp to remove all new lines/line feeds before a
line starting with one or more white spaces or tabs.

I've tried myself but I'm just nog good with reg exps.


Thanks in advance,
Nicklas

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




[PHP] Help invoking a regexp

2002-07-25 Thread Nicklas af Ekenstam

Hi

I have this regular expression:

(((http|https|ftp|gopher)|mailto):(//)?[^ \t]*|www\.[-a-z0-9.]+)[^ .,;\t\):]

Which is supposed to match hyperlinks. I would like to use this
from php to grab all hyperlinks in a text file and return them
in an array.

I've messed around with the function preg_match_all() but I just
can't seem to get it to work. Any suggestions would be very 
appreciated.

Thanks,
Nicklas

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




Re: [PHP] mailing in batches

2001-07-24 Thread Nicklas af Ekenstam

So sprach »Justin Farnsworth« am 2001-07-24 um 04:52:57 -0400 :

  Handling all those bounces manually will be a mess.
 

From: Don Read [EMAIL PROTECTED]:

 No matter which MTA you use.

I'd have to disagree slightly here. Using qmail as your MTA would bless you
with the VERP (Variable Envelope Return Paths) function which, if used
correctly, is reason enough to go with qmail on a project like this.

- Nille  his 5 cents.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Propably easy regex question

2001-07-24 Thread Nicklas af Ekenstam

Hi

Could anyone help me with a code snippet that would take a string and add '
' to it at the start of every new line just as a mail client does when
replying to a mail?
I.e. I would like this:

Hello,

How are you?

To look like this:

 Hello,

 How are you?

When it's done.

(Actually I would love it if it would also look for existing  at the
beginning of a line, and if there are any, just add the  and not the white
space but perhaps thats too much to ask for ;-)

Thanks!

- Nille


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Fetching binaires from an e-mail

2001-07-10 Thread Nicklas af Ekenstam

Nicklas af Ekenstam wrote:

 Hi

 I'm currently trying to rewrite one of my old perl applications to php
 and everything works great except one thing:
 I can't figure out how to write a piece of code that will fetch and
 unencode all binaires, if any, from an e-mail message in an imap stream
 and return them so that I can save them to disk And rest assured it's
 not for lack of trying ;-)

 If anybody here has seen or written something like that and wouldn't
 mind sharing that code with me I'd be forever grateful.

Since I didn't manage to get anywhere with Richard Lynch's tip (thanks
though) I figured I'd try asking again and see if there are any takers on
this now.

Thanks!

- Nicklas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Fetching binaires from an e-mail

2001-06-26 Thread Nicklas af Ekenstam

Hi

I'm currently trying to rewrite one of my old perl applications to php
and everything works great except one thing:
I can't figure out how to write a piece of code that will fetch and
unencode all binaires, if any, from an e-mail message in an imap stream
and return them so that I can save them to disk And rest assured it's
not for lack of trying ;-)

If anybody here has seen or written something like that and wouldn't
mind sharing that code with me I'd be forever grateful.

Thanks!

- Nicklas


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Finding every even 100

2001-03-21 Thread Nicklas af Ekenstam

Hi

Propably a really simple question, but my math skills are not up to speed 
anymore:

How do I find out if an int is an even 100? I.e. 100, 200, 1200, 9900 etc.
I could always divide by 100 and have a look at the result and se if it has 
any decimals but I'm guessing this could be done prettier using modulus. Right?

- Nille


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Unix-time problem

2001-03-04 Thread Nicklas af Ekenstam

Hi!

I wrote this simple function to return the current date minus supplied 
number of years:

function get_birthdate($age_in_years)   {

// get the current timestamp into an array
$timestamp =  time();
$date_time_array =  getdate($timestamp);
$hours =  $date_time_array["hours"];
$minutes =  $date_time_array["minutes"];
$seconds =  $date_time_array["seconds"];
$month =  $date_time_array["mon"];
$day =  $date_time_array["mday"];
$year =  $date_time_array["year"];

// use mktime to recreate the unix timestamp
// subtracting age_low and age_high from the years
$timestamp =  mktime($hours, $minutes,$seconds ,$month, $day,$year - 
$age_in_years);
$birthdate = strftime("%d/%m/%Y", $timestamp);

return($birthdate);
}

You, obviously, call it like this: echo get_birthdate(1);
Which would return a datestring that looks like this: 05/03/2000

Works nice, but the problem occurs when I try to subtract more than 31 
years which is naturall since, as far as UNIX is concerned, the world 
didn't exist then.
(Took me a while to figure this one out though.)

Any clues on how to fix this so that I can go beyond the past 31 years?

Sincerely,
Nicklas


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Php and forking

2001-01-31 Thread Nicklas af Ekenstam

Hi!

Is there some way (perhaps using a multi threaded httpd?) that I can get 
php to fork processes?
I.e. I'd like to have a script which prints something to the clients web 
browser and terminates that http connection, but keeps going in the 
background doing other processing not related to the client and, if 
necessary, pipes that output to /dev/null.

- Nille


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Richard Heyes HTML Mime Mail class

2001-01-30 Thread Nicklas af Ekenstam

Hi all!

I've just downloaded and started playing aorund with ? echo($subject); ? ;-)

Looks great! Only one problem though:

I'd like to be able to use the included smtp-class for delivering serveral 
messages through the same smtp-connection before closing it and I'm too 
stupid to figure out how to do it myself. Does anyone here have any sample 
code or tips? Would be greatly appreciated.

Thank!

- Nicklas af Ekenstam


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sorting an array

2001-01-18 Thread Nicklas af Ekenstam

Hi!

I have an array that looks kinda like this:

NAMEADDRESS
John DoeSome Street 1
Jane DoeAnother Street 2
Bill Gates  Helsinki 666

How do I sort this array based on NAME? ADDRESS?

Thanks!!

- Nicklas


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]