FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FudAPI Examples
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: FudAPI Examples [message #35934 is a reply to message #19431] Wed, 21 February 2007 00:40 Go to previous messageGo to previous message
dardhal is currently offline  dardhal   Spain
Messages: 9
Registered: November 2006
Location: Spain
Karma:
Junior Member
Sorry if the following is too naive, or has been somewhat been replied before elsewhere, but didn't find an answer.

The fact is I am doing some kind of thread and message automation: a cron job downloads a document (PDF), checks some data inside it, and then creates a new reply under an already existing thread with a simple body text and the ZIPped PDF document attached.

The horrible but simple PHP code I have created is the following. It is run from the command line through a PHP 5.2.0 Debian binary:

#!/usr/bin/php -q
<?php

require_once("/srv/www/www.site.es/fudforum-2.7.6-nobrowse/include/GLOBALS.php");
require_once("/srv/www/www.site.es/fudforum-2.7.6-nobrowse/scripts/fudapi.inc.php");

$subject = "Message subject";
$body = "Simple, concise, message body";
$attachments = array("/tmp/compressed_pdf.zip");
fud_new_reply($subject, $body, 0, "username", 1080, null, $attachments, null);

?>


Except for a couple of warnings I consider irrelevant to the problem, it seems to run OK, and in fact a new message is created under the message with ID 1080. Even the attachment information gets added, the linkable icon and that. Size reported for the attached file is OK, however, it downloads a zero-length file.

Checking the FUDforum logs shows the problem. The PHP script runs, but leaves the following in the logs:

[Error] unable to move uploaded file
[Message Sent to User]
From: srv/www/www.site.es/fudforum-2.7.6-nobrowse/tmp/fuda_eqxSg9
To: /srv/www/www.site.es/fudforum-2.7.6-nobrowse/files/190.atch
[User IP] 0.0.0.0
[Requested URL] http://


And the same problem happens running the PHP script (remember, from the command line) as user root or as the webserver user (www-data). Both users have enough permissions on both directories, and the original file "/tmp/compressed_pdf.zip" is also accessible and with proper permissions.

Any clue about this? Maybe I am oversimplifying the script, but my PHP skills are null, and fudAPI knowledge is still quite low.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Deleting Moderation Queue
Next Topic: integration with a cms (the user database) possible?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 09:56:33 GMT 2024

Total time taken to generate the page: 0.04256 seconds