I know that there's a lot of posts about that, but i can't find any one that suit my needs.
Here we go: I am developing (newbie dev, of course) an iOS app that is suppose to populate an UITableView with the acquired data from a xml report from a server (mysql and php).
The point is I was able to manually generate the sql report on the server (actually is a wordpress plugin that manually generate and save the report inside a folder on the server) and made the app download it by pointing to the right location of the file (very basic i Know) but is there an easy way of making my app send a request to the server to automatically generate and download the xml?
All the data i must use is inside a database on the server. The parse of the xml is not that difficult and I can handle it. My real problem is allowing the app sending those requests to the server.
Please note that i have no experience in PHP or SQL and have poor knowledgement on that tools so that is what i haven't found any post that suits me as all of them talks in a advanced SQL and PHP language.
All help is appreciated.
Thanks in advance folks!
You'll want to make an NSUrlRequest against a php script on your web server that runs the query and returns the XML as the output. See this link from the Apple guide to get you started: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
The question is too general to give more specific advice than that you should take a look at the Cocoa URL loading system, or alternatively another networking library such AFNetworking.
Related
I'm learning to code and encounter a problem with making a form using HTML.
In the book, it stated that "every <form> element requires an action attribute and its value is the URL for the page on the server that will receive the information in the form when it is submitted."
But I thought about it for a long time, and I couldn't figure it out. What is meant by "the URL for the page on the server". If I got a site uploaded to a web hosting company, I would need to get it there? Or I need to rent a server elsewhere so that I will get one? Or it just fine to be store on a local file? Because I saw the data need to be processed by PHP, although I don't know whats that.
Can anyone help me with this? Really appreciated.
Regards,
Ace
An HTTP(S) URL will include a hostname (which identifies a computer (acting as a server) on a network) and a path (and possibly some other components which don't matter for this question).
When you type a URL into the address bar of a browser, the browser will make a request to the server and ask for whatever is at the path.
The server will respond (typically with some data like an HTML document).
The server has to perform some logic to decide what to respond with. Typically this will either be:
Reading a file from its hard disk and returning the contents or
Executing a program and generating some content programmatically
When you submit a form, you are making a request to a URL with some data attached to it. Almost all of the time you will want the server to execute a program and do something with that data (such as put it in a database).
The program that gets executed can be written in any programming language you like (such as Perl, PHP, JavaScript, Java, or whatever).
If I got a site uploaded to a web hosting company, I would need to get it there?
Typically, if you have web hosting already then you will use that web hosting for any server-side programming you need to do.
If the hosting service doesn't provide you with any server-side hosting options (i.e. if it is just static hosting such as you might find from Github Pages). Then that isn't an option. Likewise if the server-side options they program aren't suitable for you (e.g. they only support PHP but you want to run something written in Node.js) then you'll have to find an alternative.
The two alternatives you have are:
Move everything to hosting that provides the features you want
Host something elsewhere and keep the majority of your site in the original hosting
(There is nothing wrong with the latter option, I have one site which uses Amazon S3 static hosting for most of it but has a couple of web services running in Heroku).
Or I need to rent a server elsewhere so that I will get one?
Dedicated hosting is almost certainly very expensive overkill for your purposes.
Or it just fine to be store on a local file?
It isn't possible to do server-side programming with a file: scheme URL. There's no server to execute the program.
If you are only working locally then you can install a web server on your computer. This is normal for development purposes.
It is probably worth mentioning that there are a few common server-side programs which are available prewritten with hosting services (e.g. contact forms which email you when someone fills them in). These typically come with advertising and require that the <form> and its contents are constructed with the specific fields the service expects. If you look for one of these be careful to follow their instructions precisely.
Aside: The statement that the action attribute is required is flat out wrong. It is an optional attribute and in its absence the form will be submitted to the URL of the current page.
HTML is a front-end tool that allows you to take inputs using a form from the user. once the user clicks the submit button a post request is sent to the back-end tool (PHP in this casse; PHP is a back-end programming language). the back-end tool handles the information given and deals with it to your liking. the action attribute is basically telling the front-end (HTML) where to give the information to the back-end(PHP) which is in the form of a URL.
i highly suggest trying out this example on W3schools :
https://www.w3schools.com/tags/att_form_action.asp
I see you want to send your HTML form data to a PHP script. You can use WAMP server or XAMP server to do this locally. You should use the PHP script file path as the input for the .
For instance,
Home.html
<HTML>
....
<form action="process.php">
...
</form>
</HTML>
So, when you submit the form , the form data is passed onto the PHP file which you can access using a $_[SUBMIT] super global array in your PHP script.
Check github for projects on HTML,JAVASCRIPT,PHP.
Here's one to start: https://github.com/kristej/Uniform-Database-Management.git
If you are sending the data to an online server, you need to own it to process it. Hence try it out locally first.
I don't if this is the right forum but I need a free application or plugin or module that I can use to pull data from mysql database and present to users on the front end. They reports should be queried by date and/or any other parameter. It should also be exported to at least CSV and maybe PDF.
Any guide will be appreciated. Thanks
USE Web application development tool
PHPMaker
I am working on an app in visual c++ which requires data to be accessed from a database which can be edited so that every time there is a modification to the data I do not have to resend the app as it will automatically update, it is also required that this is a desktop app.
I am currently using MySql however for this to run constantly I will be needing a server which for a single simple app wont really be worth purchasing, so I started thinking of alternative methods and thought to myself there must be some method of reading directly from a website or online database, am I correct in thinking this? If so could someone please explain how I would achieve this?
Also, I have purchased phpmyadmin in the past so if there is any way I could connect my visual c++ app to a database from this then that would be great.
EDIT: Note, this app relies almost entirely on the database as it is just 3 combo box's and one text field all of that values for which come from the database.
The following response is assuming that by online you mean on the web.
You cannot exactly 'connect' to an online database with C++ (or anything outside of that server hosting the database).
What I would do is create some PHP API's that you can POST to with libcurl via C++. You can both send and receive data this way.
I'm developing an app that displays a list of products that are in stock from various electronics websites. I have two methods in mind for accomplishing this task.
Create a C# application that parses the html from the various websites and updates a SQL table, use a php script to get data from the SQL
table, display it in JSON format, and parse the JSON with the iPhone
Use the iPhone to parse html from each website, eliminating the need for a server and SQL database
I don't know all the pros and cons for each method, but I do know that hosting a web server with a SQL database costs money. However, using the iPhone to parse html from over 40 websites could be very slow, and use a lot of data.
Which one is the best method for creating an app like this? Am I even on the right track?
Thanks,
Miles
I would prefer the web service approach in which I would parse it on my own server and then serve a JSON representation to iPhone.
Why?
Because when something changes on the html you won't need to wait for Apple to confirm your app change, and user will not need to update his app.
Your First Option is much prefered with little change. You Don't Need C# TO parse the HTML as PHP has all options you need. IT can save data in Database and similary can output in your desired format.
As per the Cost, using Iphone may cost you more with data usage(Operator service Charges) as compare to web server hosting with PHP & mysql. Further you can have already optimised facilities of HTML parsing in own server with tendency to meet all complexities served on WEB.
I am doing a Web project, where I am using HTML5 and Django to store database in sqlite3. The part being, since I had to use python, I installed mod_python for apache2. Now the thing is I went through many sites for head start to store the data and retrieve it. When I check in google related to how to use mod_python I did get certain information on how I can send a request to a .py file and then execute it. But with Django documentation providing a tutorial which is to develop a polling webApp, I am not finding it measurable to the part I am trying to achieve.
I want to send the request from an Html file where I have a search box and some radio buttons, to Django through Apache2 (mod_python) and then access my database in sqlite3. Please could anyone give me brief idea on whether I am doing it right? Also if yes, can u give me a hint as in how can I send the request from HTML file to the database from Django and mod_python being used? I am a bit confused with Django tutorial.
Please if anyone can just let me know what exactly I should do! Or if any link with a proper guidance would be of great help.
Thank you.
Well, for starters, if you can install and use mod_wsgi instead of mod_python, you should -- mod_python hasn't been supported for years. I'd also strongly recommend that you use anything other than SQLite for a production web application -- SQLite doesn't cope well with multiple simultaneous transactions.
If you're stuck using mod_python, then see the Django documentation for using mod_python.
Once you've got that working, the rest of your questions can be answered by the Django Tutorial, particularly part 4, which covers the use of HTML forms with Django views and templates:
http://docs.djangoproject.com/en/1.3/intro/tutorial01/
http://docs.djangoproject.com/en/1.3/intro/tutorial02/
http://docs.djangoproject.com/en/1.3/intro/tutorial03/
http://docs.djangoproject.com/en/1.3/intro/tutorial04/