Magento Server Side Form Post - php

I got to get some points for this question cause I can't find a good answer anywhere :P Or atleast I don't know the proper terminology for doing this type of post.
Anyhow I want my magento application to dynamically make a post to a external server. I know Magento has some libraries that allow you to dynamically add values and create a post from the controller or model layer. I just can't find any good resources to do so. Could someone provide or show me a good example on how to set some values and submit a post to the external server ?
In a nutshell I want the user to make a post to my server, I evaluate the data, and if the criteria's are met, I will redirect that data in a post to another server.
I also want to utilize the magento Form libraries to do so, I don't know which libraries give me access to do this.

Take a look # Varien_Http_Adapter_Curl
See
Using CURL Functions in magento

Related

A newbie PHP question - hiding PHP variables from URL

I'm creating a feature for a game and came up with a problem I can't solve on my own. I made an image generator to show the top dogs of guilds from a JS based Discord bot, the script which generates the image is made with PHP and it's on my server. I'd like to be able to call this script, without the resulting URL showing all the details - at the moment it looks like this after a call:
http://www.scam.fi/aow/im.php?m=NBA_-_TOP_3&b=ArkA&c=lenipeni&d=Sandwich&1=7334&2=6978&3=6682
(Don't be afraid of the domain name, I named my Internet storage unit badly). While all those variables are visible, that creates a problem for me since the results are pretty easily modified by anyone. Is there some way I could hide the variables with MOD rewrite or is there some other way?
Is there some way I could hide the variables with MOD rewrite
No. The data, with the approach you are taking, needs to get into the script from the browser.
or is there some other way?
Store the data in a database. Associate it with an ID. Put the ID in the URL.

How can I rename the WordPress AJAX URL?

I'm currently looking for a way to change / hide the default WordPress admin-ajax.php URL. I want to do this to remove the admin from it to prevent misunderstandings by my customers when I use the AJAX URL to read for example a file from my server. In this case, the URL has the admin prefix which is a bit confusing.
So in result the AJAX URl should looks like this: ajax.php
I've searched a bit but I can't find any helpful information. Because of this I can't show you any related code. But when I got it, I'll update my question to help other people.
Alternatively and perhaps more effectively you could leverage WP API and create a custom endpoint to process your data so that there isn't url confusion.

Laravel latest 5.4 how to implement publish

I've been thinking about this for weeks now and can't seem to get a possible solution on how to implement a publishing feature? like in a wordpress page you need to publish the page so the changes will be reflected in the live website? How do you normally do this kind of functionality? I'm just confused because if I change the data in the database then it will affect the live site even though i'm still editing the page. Any tutorial or resources would be very dope. Thank you guys, Have a great day.
I don't have any tutorials or resources to give, but my advice is separating types of content you use. For example, when you are editing something, make sure it's type is set to "draft" or something like that. When you publish, just create a copy of draft with a type of "published".
Yes, you will have duplicated data in the database, but when showing content on page, you won't see it.
I am afraid there is no other way to do it, except maybe having one model have additional fields, which are meant for just editing and when published, their values get assigned to the main object variables.

Wordpress admin plugin to save hidden input data to database

I am creating a Wordpress plugin for the admin area. It needs to set options and write to a file and database based on the options that are saved.
I have tried creating a "Create File" button which sends POST data back to itself. I now need to create a file and add a column to the database based on a hidden boolean filed.
I'm struggling because I can't do what I want because the form needs to have a different action. Any advice on how to so this?
What a different action? Without any code examples that show what you're doing and what exactly is not working, we only can imagine and give you general info. In Wordpress, you don't have to care about naked url options cause the core will do this for you. Its enough to register the required hooks, read the passed data here and do what is required with them. Simple storing settings wouldn't require to extend the database scheme, since Wordpress already have a table for this. You could use the Wordpress functions here.
See the article of the Wordpress developers page: https://codex.wordpress.org/Creating_Options_Pages
Using the hooks, its no big deal to create a file too. Simple write your PHP code after saving the settings in the database. How you concretely do this depends on the requirements: Is the data passed as form field? Is it fetched from an external source (like api)? Depending on the requirements this should be done with relatively less work using a search engine, cause enough sample codes exists for those scenarios.

Getting a discussion forum /query support on my website

I want to have a forum like thing on my website.I dont want any complicated thing, just the user must be able to post questions and the administrator(that is me) can answer them..(It would be nice if it has tree like structure but even without that it is fine) ..All the users can read the questions on the forum anytime(obvious) ..I dont want to put phpbb3 or any such readymade tool..I just want to be it simple (something like this scroll to the bottom) ..How to get this thing done..If possible in php please tell that..Otherwise tell other options..Please help me out..
You could probably do something like this in WordPress. (Your local webserver would need to be running MySQL as well as PHP to achieve this.) At the simplest level you could set up a page and allow user comments on it.
A really simple way is just to have a basic form with text-input, textarea, and submit button. Then have the person input their name, question, and submit it. Make sure you validate the form with js and/or php. Then update a password protected page that only you can access with the name and question. Then using whatever cms you have for this page (or just static html if you have the patience) you can just update the front page with the new question and answer above the form.
The best way, though, is going to be some kind of "readymade" system that you tweak...

Categories