This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
iPhone: Post data to php page
Passing Data From iPhone app to PHP file
What is the best way to send simple numerical and textual data from an iphone app to a php application?
Essentially what I am trying to do is to get the data input by users sent to a php file so it can be stored in a remote database.
What is the best way to send data from an iphone app to a php app so it can be stored in a MYSQL database...
assuming you know which fields are being sent, there is nothing to stop you sending the data via post, but make sure you validate/sanitise on the php side.
if you choose to go this route, I would have a look at http://allseeing-i.com/ASIHTTPRequest/
You will want to use NSURLRequest to post data to a PHP file on your server. There are also some libraries out there such as http://allseeing-i.com/ASIHTTPRequest/ which you could use instead.
Related
This question already has answers here:
RAW POST using cURL in PHP
(2 answers)
Closed 3 years ago.
There is a website that when you fill some form, it send a xhr request with some content of the form in the payload header. The content is similar to this one (not exactly this, this one was extracted from another website, but the same format of content separated with pipes):
7|0|5|https://www.bosscapital.com/app/Basic/|B8CC86B6E3BFEAF758DE5845F8EBEA08|com.optionfair.client.common.services.TradingService|getAssetDailyTicks|J|1|2|3|4|2|5|5|CB|U9mc4GQ|
I want to replicate this request with cURL but I don't know how to do it. I don't know the name of the input fields (because the have no name in the HTML code and I can't find the request on the JS).
I was looking at some Stack Oveflow treads like this, this or this, but still is not clear for me how to do it.
Hope you can help.
P.D.: I know how to use cURL, but I din't even know this Request Payload thing before this job was assigned to me.
I strongly recommend you to use Postman to run your call (or see the curl version)
https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop
with the interceptor to catch the XHR request https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo
This question already has answers here:
What is the difference between client-side and server-side programming?
(3 answers)
Closed 8 years ago.
I have a page with a java script that adds a row to a table. On the same page there is a PHP script that should read the table and add it to the database. How do I read the table using PHP ?
What you're thinking of will not directly work.
A Javascript script is executed on the client side only, whereas a PHP is executed on the server side only, and before the datas are sent to the client.
PHP can not directly read the table.
What you can do is use AJAX to send the data from the user's browser to a PHP script that'll use them.
You'll find more infos here.
PHP is serverside programing, the PHP code serves data to the client - PHP can't read from the client.
If you add a row using javascript, PHP has no way of getting that info.
You'll need to use Ajax to solve your specific problem.
You cannot "read the table" with PHP. You will have to send the data of the table to the server (and read it with PHP) using JavaScript or CGI.
A well-known technique to do this is called Ajax.
This question already has answers here:
How do I close a connection early?
(20 answers)
Continue PHP execution after sending HTTP response
(13 answers)
Closed 9 years ago.
So I have a PHP script that handles post requests. It works quite good, but (always a but) the data I am receiving is encoded. I need to run an external program to decode it. That also works.
My problem is, that my client connects to the server, does a POST and waits for the OK reply from the server, to verify that the post request has been handled correctly. Now when I add the part of the Decoder into my POST request handling script, it takes some time for my client to receive the OK from the server. It is only sending it back when the entire script has been finished, and not only the uploading of the files part, understandably.
What I was wondering now, can I do this in another way? When the uploading of the files is done, the client should now that the upload is finished. He should not have to worry about the decoding part. I also need it to decode immediately after the POST request has been handled, so I'm a bit puzzled at how I need to do this...
Don't really think I need to give out my code but if the need should arise i'll be glad to oblige.
This question already has answers here:
Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?
(12 answers)
Closed 9 years ago.
I have a code and need help. I have a curl call with a bash sign like this
http://example.com.ua/script.php
clients send me data using a script but some send me the bash # which I need to save all the data to my database. When I get $_SERVER I don't see all the data how can get all the data?
for example:
I have
http://example.com.ua/script.php#code1234
I need to save:
example.com.ua/script.php#code1234
but I see
example.com.ua/script.php
PHP does not have access to the location hash, period.
You only have access to querystrings in PHP, and if you need to get the hash, you would have to use javascript to get it, and send it to your PHP script with ajax.
This question already has answers here:
php : Capturing the command output
(3 answers)
Closed 8 years ago.
I have a PHP program, and a Python program. You can think that the Python program is like a robot or machine. Typically, it will use a database, do some analysis and return result for you. It is a plain text console application.
I would like to let the user use the program via a web interface. So, I would like to use PHP, accept user input, and the pass it to the Python program, and back to the user.
How can I achieve it? The Python program is always running on the server, which will keep analysis data from the web and the user input, so it can't easily convert to become a script on server side.
Any ideas?
You might want to check exec function. You can pass the input from user as parameters to the python script and get back the output from it.
Take a look into http://www.csh.rit.edu/~jon/projects/pip/