[PHP] fread(): SSL: fatal protocol error

2003-08-28 Thread Ray Van Dolson
I'm running PHP 4.3.3 compiled with --with-openssl against Red Hat 8.0's 
latest OpenSSL libraries (patched versions of 0.9.6) and am having some 
strange issues using fopen(), fread() and friends.  Here's my code:

function echo_test() {
  $opts = array(
'ssl' => array(
  'allow_self_signed' => "TRUE"
  )
   );
  $context = stream_context_create($opts);

  $handle = fopen("https://www.secureurl.org/";, "r", FALSE, $context);

  while (TRUE) {
$data = fread($handle, 1024);
if (strlen($data) == 0) {
  break;
}
$stuff .= stripslashes($data);
  }
  fclose($handle);
  return $stuff;
}

When I run this code, the content IS returned correctly and in in the 
server SSL logs I see that a request was made via SSL.  So I'm getting 
the results I want... EXCEPT for this:

Warning: fread(): SSL: fatal protocol error in /WWW/inc/ECHO.php on line 
23

Any idea what this is?  I thought not allowing self signed certs might 
be the problem since this server is using a self-signed one... but 
adding that to my options (reflected above) didn't help any.

I can very easily force the errors not to show up and mosey on since I 
am able to access the data, but I'm curious why this is happening.  Any 
ideas?  There were a few other posts on this topic, but none with any 
concrete answers or solutions...

-- 
Ray Van Dolson ([EMAIL PROTECTED])
http://www.bludgeon.org/~rayvd/

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



[PHP] Replacing text in a PDF file -- suggestions.

2003-10-23 Thread Ray Van Dolson
I have a PDF file generated in Adobe Acrobat 5.0 in which there are 
several fields I would like to make customizeable.  My thought was to 
create fields in the PDF file named %%STUDENT_NAME%% and then basically 
do a search/replace on the PDF file with PHP resulting in a PDF with the 
student's name in place of the variable.

However, my initial attempts at this have been thwarted because I can't 
figure out how Adobe is encoding the strings within their files.  I have 
a snippet of code that uses a regular expression that I am guessing 
works with PDF files generated from older version of Acrobat -- the 
replace function uses ereg_replace() which isn't binary safe and the PDF 
files generated by Adobe 5.0 definitely appear to be binary (FWIW the 
regular expression it uses appears to be wrong as it won't work even 
with preg_replace()).

So, either I need to dig into some documentation and figure out Adobe's 
file format, figure out a way to get Adobe to generate ASCII PDF files, 
or generate my own PDF files using PDFlib or something similar.

I've asked a few different places and was told to use a full blown 
templating engine... this seems like such a trival thing though..  just 
replace some text in a PDF file!

Anyways, just looking for some suggestions.  Right now I am thinking 
that generating the PDF file myself will be easier than figuring out how 
to match and replace text in Adobe's PDF 5+ files.

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


[PHP] Why doesn't this work?

2001-09-14 Thread Ray Van Dolson

I've come across this problem enough that I want to find out if there's a 
way to make it work, or if this is just a limitation of PHP.  Here's what 
I'm trying to do:

print split("=",$testString)[0];

This gives me a syntax error.  I've also tried:

print (split("=",$testString))[0];

Along with other permutations...  the only way I can get this to work how 
I want it to is to create a temporary variable first.

$tempVar = split("=",$testString);
print $tempVar[0];

Now I guess this is easy enough to do, but I'm just used to doing it the 
other way.  And the documentation for split() says that it should return 
an Array... why can't I operate on it as I would a normal array?

Anyways, thanks for any help.  I guess I'm just too used to Python. :-D

Ray Van Dolson

-- 
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]