Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
PHP: HTML reponse to variable
Name: fem Date: October 8, 2004 at 02:17:36 Pacific OS: W2k CPU/Ram: 400/256
Comment:
I have a PHP application that submits a string of data to a partner's server via GET mechanism. As a reponse, partner's server generates an integer (submission ID) and sends it back to me. I can see this integer if I put my outbound string into the browser and execute it, but I do not know how to make my PHP application to capture this value and insert it into my MySQL database automatically. What function should I use? As you can see I'm a newbi to PHP. Oleg
Name: SN Date: October 8, 2004 at 06:50:34 Pacific
Reply:
I assume by "sends it back to me", you mean you can see it in the browser window when you do it manually.
To do this in PHP, use file_get_contents(). Assuming the partner's server returns only the integer (ie not any HTML), it could work something like: $submissionID=file_get_contents("http://www.server.com/order.aspx?ordernum=12&items=3&total=22");
Note that you don't have to pass this string to your partner's server anywhere else...Just the line above will do it.
Good luck, -SN
0
Response Number 2
Name: fem Date: October 8, 2004 at 10:46:17 Pacific
Reply:
SN,
Thanks a lot for such a prompt reply. I will try it over the weekend.
Thanks again, Oleg
0
Response Number 3
Name: fem Date: October 12, 2004 at 03:34:14 Pacific
Reply:
Interestingly enough I was able to use the same function for passing data to a server using GET method. All I had to do was to concatenate url of the server with my variables, urlencode() the lot and then insert result into file_get_contents() and I had my GET data submission and server response in one go ... thanks a lot for your advise. Oleg
Summary: It's fairly simple. CGI-like behavior means that scripts and the server exchange data (that's the short version). In PHP, there are global arrays, called superglobals, which hold user input via HTML...
Summary: OK, so I'm using php and thanks to your search suggestion, I've found the solution to my problem. For those interested, keep on reading... Assume the mp3 file is called 'myfile.mp3' and its path is th...
Summary: Assuming you're using apache, look in your server configuration file httpd.conf. Whatever you set your DocumentRoot as is where your php scripts should go. By default it should be your htdocs folder...