At https://github.com/apanzerj/Former-For-Zendesk/blob/Lesson-1-Branch/former.php there is a Zendesk repository for sending the contents of a custom HTML contact form to Zendesk's server.
I'm building an AngularJS website and I'd like to have this same functionality but using Angular's $http.post method instead of PHP CURL.
I'm at a loss on how to convert their thing from PHP to Angular though. Any tips would be greatly appreciated!
Is it even possible to go from AngularJS directly to Zendesk's server, without a server-side language on my end that passes the data?
Related
i have to integrate Angular 4 in my existing Php(Codeigniter) Project but i am not able to find right way to integrate angular 4 . any one know this process.please Share
If you are using node.js for backend. You wont need Php. It will be just NodeJs and Angular.
Without NodeJS, You can use Php to write your APIs and have front-end in Angular which will call those APIs using HttpClinetModule.
If you want to use Angular4 you should remake the frontend in Angular4.
Then on your NodeJS backend create rest routeshttp://localhost:3000/tasks for example would return a JSON object.
Then connect to your NodeJS route (http://localhost:3000/tasks) (from angular) using HttpClientModule and it'll return a JSON object then return that data from your service to a component that you want to display the data in, and either subscribe to it in the component or use the async pipe to unpack the data.
P.S you could also use your current PHP project and make that into an API.
one of my vendor he is asking a posting page where he can send some varaibles from his portal which is in asp.net.
My website is in php. what posting page i should be providing him and how to fetch whatever he is sending.
You may disable the CSRF validation (if you have any) to achieve this task.
However the standard way is to create webservice to achieve this goal.
The best and easiest API to implement is RESTful.
Here is reference to that:
How to create a simple REST API in PHP
Creating a simple REST API in PHP
It doesn't matter what language the vendor use or what you use...
He need to you to specify him what is your script URL that you allow him and expect POST request from him to do what he need.
If it's from his server side (for example in PHP we use curl),
so he need to use asp.net way to post request...
maybe this will help him how to do it
How to make HTTP POST web request
If he doing those request from client side (ajax),
so he can use jQuery http://api.jquery.com/jquery.ajax/
and in your side to allow in the php script the "access control allow origin"
see:
how to bypass Access-Control-Allow-Origin?
I'm still quite new to angular2/4 so forgive me if I'm missing something obvious.
I am trying to update a booking process and we are doing this with angular2/4. Currently the booking process starts on a php website, once some basic information is filled out the angular app is supposed to take over. What I'm not sure of is how I'm supposed to take the form data from PHP and receive that data in my angular app.
There is an express.js back end for the angular app, but I don't understand how I would be able to post from the PHP site and return the result to the angular app.
Again sorry, I'm still new to angular so I'm not sure how I should approach this.
Create an API (http://localhost:8080/bookings/) in your existing PHP application which your angular app can access via a GET/POST request using angulars HTTP client. https://angular.io/guide/http.
Or
Alternatively, use the express backend to talk to the MySql DB / Or other DB that your php application is using. Use express as an API similar to the above or simply render the page with the data obtained from the DB. https://expressjs.com/en/guide/database-integration.html
i use zend framework and work with some web services(insert, update, delete but with int, string parameters). Now i don't how to upload file(for example image) with zend and web services(REST). Does anyone have some example?
You should send the file throught post call. The Rest service will receive the postAction as when you do what ever other functions. But, with files you cannot make the calls with ajax, so you have a little trick to do in client side.
Remember, REST service will implement post action and receive the parameters as you would receive normally. If you know how to receive and manipulate a file with standard php, you can do it in REST service implementation.
The trick on client side is to create an invisible iFrame and redirect the submit form target to it.
This links explain this method very well with code samples:
form POST in iframe without affecting history
http://ajaxpatterns.org/IFrame_Call
http://geekswithblogs.net/rashid/archive/2007/08/01/Create-An-Ajax-Style-File-Upload.aspx
http://www.openjs.com/articles/ajax/ajax_file_upload/
http://viralpatel.net/blogs/2008/11/ajax-style-file-uploading-using-hidden-iframe.html
NamastĂȘ !!
I'm developing backend system for iPhone app providing JSON data for each request for iPhone app. This is Cakephp based backend system and I was wondering if there was a good Cake way to receive POST request?
I understand using Router::mapResources(), Router::parseExtensions(), requestHandler component, Xml and Javascript helper is the correct way of creating RESTful application? If so, I was wondering how we could set them up to accept POST requests and potentially XML and/or JSON aswell.
Thank you
I was wondering if there was a good Cake way to receive POST request?
send a POST request to the correct url, and you can process it as normal. The POST data is in $this->data in the controller.
If so, I was wondering how we could set them up to accept POST requests and potentially XML and/or JSON aswell.
XML and JSON are not in the same category as POST. Read about REST setup here