vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   New post from another server (https://vborg.vbsupport.ru/showthread.php?t=266560)

vertygo 07-10-2011 05:24 AM

New post from another server
 
What is the best way to submit a new post from a seperate server using php ? Not interested in RSS feeds.

If I'm doing data entry for another website, I want to tick a box and have it create a new post on my forum.

I do have php programming experience, I just have no idea where to start with this.

Disasterpiece 07-10-2011 05:54 AM

You could create a php script, which uses a defined user account in forum#2 to log in and send a POST request to newthread / newreply.php with the post data you want to send.

depending on your php experience, you should take a look at the curl docs on php.net

vertygo 07-10-2011 06:20 AM

Looks like a great place to start. Is there an example of posting an new thread (containing html) with a user account ?

I took a look at the variables and arrays in newthread.php, and there's alot. :) No problem using cURL to send the data, just need to know what data is essential, and if it can handle html.

Disasterpiece 07-10-2011 06:31 AM

1 Attachment(s)
Well, this is what a quick reply form looks like:

Attachment 130860

You should be able to recognize what you will need to send.

The securitytoken will be a problem, you'll need to login, download the frontpage to get your generated securitytoken (it's in the html code in plaintext, so you just need some regex to grab it).
The login method is also a POST request to the login form. You'll need a securitytoken again, so this is a bit of code and tricks to get it working, but it's doable.

Another method would be to create some kind of API script on your server, which accepts all the necessary post data and inserts them into the database directly.
You'll need to have an idea of the internal vbulletin functions to create posts/threads OR you try to inject it directly with a mysql query.
Biggest problem will be to make the script secure, but then again you simply need to check the request IP for equality with the server ip running the mod.

Here are neat examples on how to use curl for simple GET/POST requests: http://de3.php.net/manual/en/functio...exec.php#98628


All times are GMT. The time now is 06:22 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05593 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete