php-general Digest 4 May 2009 06:52:58 -0000 Issue 6102

Topics (messages 292234 through 292239):

Re: Static and/or Dynamic site scraping using PHP
        292234 by: Ashley Sheridan

Re: utf-8 ?
        292235 by: Reese

Re: Paypal and Php
        292236 by: Matthieu

Re: Dynamically Rename Images
        292237 by: Andrew Hucks

compiling a test php from latest csv snapshot on os-x
        292238 by: Tom Worster
        292239 by: Michael A. Peters

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 ---
On Sat, 2009-05-02 at 13:08 -0400, Paul M Foster wrote:
> On Sat, May 02, 2009 at 10:40:04PM +0600, Lenin wrote:
> 
> > On Sat, May 2, 2009 at 10:01 PM,
> > <[email protected]>wrote:
> > 
> > > Je suis actuellement absent du bureau aussi !!!!<br><br>TEST !!!!!
> > >
> > > I dont get it why I get this automated mail everytime I send message to
> > this thread.  :-/
> 
> My French is rusty, but it looks like it says something like "I'm out of
> the office". So it would appear this <ahem> person has an autoreply
> going.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 
I've got it for every email I send to the list as well! It's annoying,
but the TEST bit just makes it funny!


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Tom Worster wrote:

Because, I thought, HTML files were basically just text files with
different file extensions, and that those other characters would not
store or display properly if saved in .txt format. Was I mistaken?

yes. see http://www.w3.org/TR/html401/charset.html

which says that html uses the UCS, a character-by-character equivalent to
the Unicode character set. so if you use a unicode character encoding (such
as utf-8) then you you have a direct encoding for every unicode character in
html.

I wonder if you've looked at any of those non-encoded characters in vi
while shelled in.

so a utf-8 html file or stream should normally to have no entities other
than &lt;, &gt;, $amp; and perhaps &quot; as needed.

Well there it is, that "should" word. I've already named one example
where "should" doesn't work as expected in all cases, here's another
one: Client blog that uses Wordpress and the UTF-8 charset. Text that
is copied & pasted with non-English letters & fancy punctuation marks
displays alright in the body-text of posts, but not in post subject
lines. I think that's because Wordpress is doing some conversions in
the background, but isn't doing them everywhere. So when one of those
is present in the subject line, there's a little glyph that shows up
when viewed in a Web browser. Unless that character is properly encoded
by me. Have you looked at the Wordpress wp-includes/formatting.php file?
Lots of busy work in the form of substituting one thing for another
thing, there.

http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2
of the characters do not display correctly on my screen.

why this doesn't work for you is not clear. it could be that your browser
has a preference configured to override the charset specified in the http
headers. or perhaps the browser does not observe the specified content type
for txt files.

I don't think it has anything to do with configuration preferences like
that. I'm running Win2K as indicted earlier, the client is running a Mac
and he sees the same thing I do - in Safari and MacFF both. What OS are
you running? I'd expect XP or Vista to behave slightly differently from
Win2k, and who knows what different Linux distros will do w/out testing.

Either way,
this next link suggests that Turkish characters with no equivalent in
the English language should be encoded for Web display:

http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm

don't believe everything you read on the web. while some browsers may
tolerate it, i don't think pages encoded according to those suggestions
would even be valid html.

I'll let you investigate that at http://validator.w3.org - I satisfied
my curiosity about that long before you said anything.

And because that is off-topic, I'll throw this in:

The consensus seems to be that the proposed "ifset()" and "ifempty()"
functions are more effort than they are worth. What I'd like to know
is, why "empty()" still exists when every time I turn around, the
mentors I turn to locally tell me not to use it, to use "isset()"
instead. Because empty() doesn't work with zero. Anyone care to take
a stab at that?

perhaps because it's hard to get rid of language elements without breaking
existing code?

Perhaps. I think Chris said it best, they serve difference purposes.
It's been my observation though, they can generally be interchanged
with minor changes to syntax. Unless working with zero.

Reese


--- End Message ---
--- Begin Message ---
Thanks a lot Brad,

I would really appreciate that!

I'm actually a totally newbie to php and mysql... but I don't lack
motivation ;)

Cheers,

Matthieu


""Brad Broerman"" <[email protected]> a écrit dans le message de news:005701c9cbe8$39249600$0500a...@brads...
A couple years ago, I wrote a simple PayPal gateway. If you'd like, I can
zip up the files and send them to you. It's really not that difficult.

After registering, you have to call a SOAP api, redirect to their page, and
then call another api when they return to your site. I can go into more
detail later if you're interested. As others have mentioned, there are some
more complex Zend framework classes for this, but you may opt for the
simpler and more direct route...

Cheers,
 Brad Broerman


-----Original Message-----
From: Matthieu [mailto:[email protected]]
Sent: Saturday, May 02, 2009 7:01 PM
To: [email protected]
Subject: Paypal and Php

Hello,

I'd like to know if somebody already configured a paypal account usin php
and a mysql database. What are the major things to know when starting to
code the php code?

I know it's quite a large question but I'd like to know the amount of time
needed, or if I directly go through a drupal server.

Thanks for your help

Matthieu




--- End Message ---
--- Begin Message ---
Thanks, but I solved the problem another way. http://codepad.org/6juIkECZ.

On Sun, May 3, 2009 at 3:02 PM, Michael A. Peters <[email protected]> wrote:
> Andrew Hucks wrote:
>>
>> Got this error:
>>
>> Fatal error: Cannot instantiate non-existent class: finfo in <place> on
>> line 6
>
> You need the pecl-FileInfo module.
> You can just comment that out that line and the line after it and (assuming
> all your images are png) change
>
> $mime_type = $fi->buffer(file_get_contents($impath));
>
> to
>
> $mime_type = 'image/png';
>
>>
>> On Sun, May 3, 2009 at 12:58 AM, Michael A. Peters <[email protected]>
>> wrote:
>>>
>>> Andrew Hucks wrote:
>>>>
>>>> Is it possible to rename images dynamically?
>>>>
>>>> Say that I had something like image1.png, and I don't want to rename
>>>> it on the server. I'm working on an image rotater for a forum that
>>>> doesn't allow anything but image files as signatures.
>>>>
>>>> Here's my code so far:
>>>>
>>>> <?php
>>>>
>>>> //LolRotator
>>>>
>>>> //add images. not too hard.
>>>> $images = array("image1.png", "image2.png", "image3.png");
>>>> //which one do we gets?
>>>> $show = rand(0, (count($images)-1));
>>>> //i r got u picture.
>>>> echo '<img src="'.$images[$show].'"/>';
>>>>
>>>> ?>
>>>>
>>>> I used mod_rewrite, which makes it from image.php to image.png. But,
>>>> because the files aren't named image.png, it doesn't work. I need to
>>>> figure out somethign between lines 8 and 10 to change the file name to
>>>> image.png.
>>>
>>> Use mod_rewrite so that request for image.png is handled by a script,
>>> image.php
>>>
>>> image.php then randomly picks a image file from list, sends the
>>> appropriate
>>> image header, and reads the file sending the content to the browser. IE -
>>>
>>> function sendimage($impath) {
>>> // requires fedora rpm : php-pecl-Fileinfo
>>>  $fi = new finfo(FILEINFO_MIME);
>>>  $mime_type = $fi->buffer(file_get_contents($impath));
>>>  $imageOutput = "";
>>>  if ($fp = fopen( $impath , 'rb' )) {
>>>   while ($l = fgets($fp)) {
>>>     $imageOutput .= $l;
>>>     }
>>>   $outputLen = strlen($imageOutput);
>>>   header("Content-Length: $outputLen");
>>>   header("Content-type: $mime_type");
>>>   print $imageOutput;
>>>   } else {
>>>   // for whatever reason we failed
>>>   die();
>>>   }
>>>  }
>>>
>>>
>>>
>>>> Is there a way to do this?
>>>>
>>>
>>
>
>

--- End Message ---
--- Begin Message ---
i've an outstanding verification to do for a php bug fix. can anyone point
me at instructions for compiling the latest csv snapshot for testing on os-x
without installing over my current installed php?



--- End Message ---
--- Begin Message ---
Tom Worster wrote:
i've an outstanding verification to do for a php bug fix. can anyone point
me at instructions for compiling the latest csv snapshot for testing on os-x
without installing over my current installed php?



I assume you can compile as a non privileged and set a prefix during configure that make install will respect.

One word of caution - make test will sometimes fail (linux systems) if an existing php installation exists, it's probably because it finds the installed php first in it's path, if you can set up a chroot build environment that's probably best, as you can then run make test after make without version conflicts causing test failures.

But to avoid over writing your existing php - log in as an unprivileged user, give write permission to /opt/testphp (or something similar) and use that as a prefix when configuring php - then you can run configure, make, make install as an unprivileged user and make install won't have permission to over write your existing php.

I'm not familiar with OS X but that should work.

--- End Message ---

Reply via email to