php-general Digest 8 Jan 2006 18:06:03 -0000 Issue 3894

Topics (messages 228296 through 228302):

any good tutorials on how to create an online shop?
        228296 by: Nicholas Couloute

thought stdin was supposed to default open
        228297 by: matt V
        228299 by: M. Sokolewicz

worked around STDIN problem from before
        228298 by: matt V

Remove atribute from links
        228300 by: Dotan Cohen
        228301 by: Jared Williams

Re: Image editing?
        228302 by: Weber Sites LTD

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message --- I need to make an online shop that lets the user select multiply files up to 6mbs then they would all send to the users email address! I need help with the online shop part! it won't involve money so no need for sequirity! ay tutorials?
~Nick

--- End Message ---
--- Begin Message ---
hello,
I read that in the cli version of php, the 3 files, sterror, stdout and stdin are already open thus saving having to open them and close them each time. Well, I decided to test that idea and it appears that stdin infact is not pre-opened, but my code may be wrong too, who knows. I made a little test script (see below), but either it ends up outputting nothing, or i get the "... assumed 'STDIN'" and "supplied argument is not a valid resource...." but on the same line.
anyway, code is below

<?php
while(STDIN != '\n');
{
$line = fgets(STDIN);
echo $line;
}
?>

simple script, but it appears not to work. is it my code, or is STDIN not opened by default in php4.4
this is on slackware linux version 10.2 running php -v 4.4
matt

--- End Message ---
--- Begin Message ---
matt V wrote:
hello,
I read that in the cli version of php, the 3 files, sterror, stdout and stdin are already open thus saving having to open them and close them each time. Well, I decided to test that idea and it appears that stdin infact is not pre-opened, but my code may be wrong too, who knows. I made a little test script (see below), but either it ends up outputting nothing, or i get the "... assumed 'STDIN'" and "supplied argument is not a valid resource...." but on the same line.
anyway, code is below

<?php
while(STDIN != '\n');
{
$line = fgets(STDIN);
echo $line;
}
?>

you DO understand that STDIN is a resource and (unlike Perl,) PHP can't compare a string to a resource! Next, you're comparing to '\n', note the single quotes; you're not comparing to the newline char, you're comparing to a \ followed by an n literally.
So..., your code will spit out errors for sure.

while(($line = fgets(STDIN)) != "\n");
{
echo $line;
}
would work though, and have the same functionality you tried to achieve in your above code.

simple script, but it appears not to work. is it my code, or is STDIN not opened by default in php4.4
this is on slackware linux version 10.2 running php -v 4.4
matt

it is opened, but you need to use it correctly to get there ;)
- tul

--- End Message ---
--- Begin Message --- hmm, it seems php -a likes to complain heh, so I decided to do my little STDIN tests in an actual script and not interactively and turned off error reporting..things are all happy again in "matt land" lol
--- End Message ---
--- Begin Message ---
I have an HTML document at home (the Firefox bookmarks output) that I
was trying to parse this morning, with many links as such:
<a href="http://www.aximsite.com/articles/link.php?id=22";
add_date="1130275531" last_charset="windows-1252"
id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?</a>

I want to parse it to remove the attributes add_date, last_charset,
id, and others that are in other entries. The text of the file it
produces is 22 kb but the HTML is over 500 kb!

I don't have the code with me that I was trying (I'm not at home now-
but it has been nagging me all day), but I was running into problems
and could NOT get it to just remove the attributes. One regex solution
left me with <a></a> and others with <>, <a href="http://address";
="something" ="somehing else">blahblah</a>, etc...

How can I get it to remove, say, attribute xxx and the ="something"
that follows it? In all fairness I am not good at regexes and need to
practice, but I would appreciate any help I can get- I'm really bogged
down with studies and simply cannot devote a full day to this
'trivial' excercise.

Thanks, all!

Dotan Cohen
http://technology-sleuth.com/long_answer/why_are_internet_greeting_cards_dangerous.html

--- End Message ---
--- Begin Message ---
> I have an HTML document at home (the Firefox bookmarks 
> output) that I was trying to parse this morning, with many 
> links as such:
> <a href="http://www.aximsite.com/articles/link.php?id=22";
> add_date="1130275531" last_charset="windows-1252"
> id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?</a>
> 
> I want to parse it to remove the attributes add_date, 
> last_charset, id, and others that are in other entries. The 
> text of the file it produces is 22 kb but the HTML is over 500 kb!
> 
> I don't have the code with me that I was trying (I'm not at 
> home now- but it has been nagging me all day), but I was 
> running into problems and could NOT get it to just remove the 
> attributes. One regex solution left me with <a></a> and 
> others with <>, <a href="http://address";
> ="something" ="somehing else">blahblah</a>, etc...
> 
> How can I get it to remove, say, attribute xxx and the ="something"
> that follows it? In all fairness I am not good at regexes and 
> need to practice, but I would appreciate any help I can get- 
> I'm really bogged down with studies and simply cannot devote 
> a full day to this 'trivial' excercise.

I'd forget regexps and use SAX style parser. Trivial then to remove unwanted 
attributes.

Jared

--- End Message ---
--- Begin Message ---
Check out these code examples to start with : 

http://www.weberdev.com/search.php3?IsSub=1&searchtype=category&category=GD+
image+library&secondary=PHP&PHPFunctions=on

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
PHP Web Logs : http://www.weberblog.com/ 
PHP & MySQL Forums : http://www.weberforums.com/ 
Learn PHP Playing Trivia http://www.webertrivia.com 
Web Development Index http://www.weberindex.com 
Web Templates http://www.webertemplates.com
Search for PHP Code from your browser http://toolbar.weberdev.com 

 

-----Original Message-----
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 07, 2006 1:59 PM
To: php-general@lists.php.net
Subject: [PHP] Image editing?

Hello,

I might have to start doing some automated image editing or rezising with
PHP. I've never done anything like this before so I would need some
guidelines to get started. Basically what sections of the manual to read and
what tools need to be installed to the server side to get things like this
done. Are there any websites about this issue, other than php.net, that
might provide help to beginners? Thanks for your assistance!

-Will

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

--- End Message ---

Reply via email to