[PHP] how to get the filesize of an online document?

2009-04-08 Thread Sebastian Muszytowski

Hello everyone,

i have a little problem. I want to get the filesize of an online 
document (for example an rss or atom feed).
I tried the filesize() function, but this doesn't work. I also search 
for options with cUrl but i didn't found any solution.


Hope you can give me some hints or code snipplets so that i can work for 
an solution.


Thanks in advance

Sebastian

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



Re: [PHP] how to get the filesize of an online document?

2009-04-08 Thread Sebastian Muszytowski

Hi,

thanks for the hint, but how can i get the size when the header isn't 
specified?


is there the possibility to count the bits and bytes when i get the file?


Sebastian

Gevorg Harutyunyan schrieb:

Hi,

You must get content-length http header value, but sometimes header is 
not set and you don't have any chance to

get size.

For more info see **get_headers** function description.

On Wed, Apr 8, 2009 at 12:31 PM, Sebastian Muszytowski 
s.muszytow...@googlemail.com mailto:s.muszytow...@googlemail.com 
wrote:


Hello everyone,

i have a little problem. I want to get the filesize of an online
document (for example an rss or atom feed).
I tried the filesize() function, but this doesn't work. I also
search for options with cUrl but i didn't found any solution.

Hope you can give me some hints or code snipplets so that i can
work for an solution.

Thanks in advance

Sebastian

-- 
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




--
Best Regards,
Gevorg Harutyunyan

www.soongy.com http://www.soongy.com



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



[PHP] stream_set_timeout issue with ssl connection

2009-04-08 Thread Sebastian Muszytowski

Hello everyone,

i have an issue with stream_set_timeout and ssl.
I've written a php irc newsbot and my code looks like this:

[...]

while (!feof($con['socket']))
   {
   stream_set_timeout($con['socket'], 
$CONFIG['qtime']);


[...]

I need this timeout because i want to read the news every X seconds from 
the Database.

I use

$con['buffer'] = trim(fgets($con['socket'], 4096));

to get the data. If i don't use the stream_set_timeout the bot would 
wait until it recieves data.


In fact this solution works, but only if i connect with fsockopen to a 
non ssl connection.


If i use a ssl connection steam_set_timeout seems to be ignored.

Any clues or workarounds?

Sebastian

PS: You can download the whole code on 
http://muzybot.de/phpircbot.tar.gz or http://muzybot.de/phpircbot.zip


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



[PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Sebastian Muszytowski

Hello :)

I have some troubles with php and mysql.  I have a normal MySQL Query 
and this returns X  3 rows.

Now i want to get the last 3 inserted values. For Example i've inserted

A, B, C, D, E

I want to get the last inserted values, e.g. E D C (in reversed order)

So how to do this? I already searched the web and the whole php.net site 
but i don't see any workaround.


Thanks in advance

Sebastian


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



Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Sebastian Muszytowski

Thijs Lensselink schrieb:

Sebastian Muszytowski wrote:
  

Hello :)

I have some troubles with php and mysql.  I have a normal MySQL Query
and this returns X  3 rows.
Now i want to get the last 3 inserted values. For Example i've inserted

A, B, C, D, E

I want to get the last inserted values, e.g. E D C (in reversed order)

So how to do this? I already searched the web and the whole php.net site
but i don't see any workaround.

Thanks in advance

Sebastian




It's not really a PHP question. But here goes :

SELECT column FROM `table` ORDER BY column DESC LIMIT 3
  

Oh okay thank you very much :)

I thought I must do this with php and some sort of mysql_fetch_asssoc or 
something like this


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



Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Sebastian Muszytowski

haliphax schrieb:

[..cut...]


Except when your primary key value rolls over, or fills a gap between
two other rows that was left when a row was deleted/moved/etc... there
has got to be a better way than grabbing rows in descending order
based on the auto_increment value.

Are you doing the inserts one at a time? If so, why not just use code
to remember what you put in the DB?
  
I do the inserts one at a time, i could use code to remember but i think 
it would be very slow when i have too much users.


The second thing that aware me from doing this is, why use/build 
ressources when you could use others? i think why should i use and add 
another system? I work with mysql already and when php+mysql have the 
function i need it's better and i don't waste ressources :)


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