Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Creating a post in a custom PHP script

Aloittaja Whitetigerswt, heinäkuu 30, 2013, 09:41:27 AP

« edellinen - seuraava »

Whitetigerswt

Hi,

I'm trying to create a new post from my own script in PHP, as sort of a 'bot' posting.

this is my script so far: hxxp:pastebin.com/RmFE0Wfm [nonactive] ( can't post links :( )

when I load the page, this is the error I'm getting:

Fatal error: Unsupported operand types in /home/content/30/11386330/html/forum/Sources/Subs-Db-mysql.php on line 51

$smcFunc += array(
'db_query' => 'smf_db_query',
'db_quote' => 'smf_db_quote',
'db_fetch_assoc' => 'mysql_fetch_assoc',
'db_fetch_row' => 'mysql_fetch_row',
'db_free_result' => 'mysql_free_result',
'db_insert' => 'smf_db_insert',
'db_insert_id' => 'smf_db_insert_id',
'db_num_rows' => 'mysql_num_rows',
'db_data_seek' => 'mysql_data_seek',
'db_num_fields' => 'mysql_num_fields',
'db_escape_string' => 'addslashes',
'db_unescape_string' => 'stripslashes',
'db_server_info' => 'mysql_get_server_info',
'db_affected_rows' => 'smf_db_affected_rows',
'db_transaction' => 'smf_db_transaction',
'db_error' => 'mysql_error',
'db_select_db' => 'mysql_select_db',
'db_title' => 'MySQL',
'db_sybase' => false,
'db_case_sensitive' => false,
'db_escape_wildcard_string' => 'smf_db_escape_wildcard_string',
); -- LINE 51


I don't do much PHP coding so I'm having a lot of trouble in the past few days just trying to make a script to post something on my forum

Thanks.

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.


residentfoul

Guys, this script uses a function named "createPost".
Where is that one defined (neither of the SSI & smf_2_api scripts has it) ?

Note : the original script is missing on pastebin.


Edit : Allright, I was looking in APIs, when this is a core function. Sorry about that.

Arantor

Easy, load SSI.php, load Subs-Post.php, run createPost.
Holder of controversial views, all of which my own.


residentfoul

#5
Yep, as mentionned in my edit, was looking in the wrong place.
Sorry'bout that.

Edit : By the way --> this works like a charm. Trying a few API style calls to create/authenticate/connect users and create/reply to posts work so good, that I finally decided to use SMF as the board tool of my web app.
This and the reactive community of course.

Advertisement: