How to extract a message from the msg_X0000 file ? [message #40267] |
Wed, 30 January 2008 21:19 |
Arafel
Messages: 18 Registered: July 2006 Location: France
Karma: 0
|
Junior Member |
|
|
Hello, i'm trying to use a subforum to post news on it and publish them on my website.
I know:
-How to get the thread
-How to get the first message
-In which file the content of the message is
-The lenght of the message
But i don't know how to extract only the content of the message.
foff is post's first offset in the file ?
Shall i use a:
"SELECT sum(lenght) FROM fud**_msg WHERE file_id = '10000' AND id < '".$thepostiwant_id."' ORDER BY id"
Then use fread and use %8192 until i reach the beginning of the content that i need ?
(considering i want a message's content that is in file id 10000)
Is there an other way ?
Thanks for awnsering and my apologies for my bad english.
Edit:
Ok, i used fopen, fseek with foff and fgets, i had to do a while strlen(result) < length
And as fgets param, i used length-strlen(result)+1
[Updated on: Wed, 30 January 2008 23:21] Report message to a moderator
|
|
|
Re: How to extract a message from the msg_X0000 file ? [message #40270 is a reply to message #40267] |
Thu, 31 January 2008 17:09 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You can use FUDAPI for this purpose. However, if you want to do it directly you need to use foff (file offset) and length parameter. Then you look at the file_id for the message and you know which file you need to open, seek to offset and read length bytes.
FUDforum Core Developer
|
|
|
|