liderbug Posted July 10, 2009 Share Posted July 10, 2009 I'm working on bulk loading data into a DB. The orig web page has the form, method=POST. Works fine ... 1. i.t.e.m. a.t. a. t.i.m.e. So I've figured out what I need to populate: $item = "Widget, red"; $quantity = 7; etc. etc. etc. Which I can do in foo4.php and then call "insert_data.php". However insert_data starts out with: $item = $_POST['item']; What I can't figure out is how to POST item in foo4 before calling insert_data :-\ Thanks. cal Quote Link to comment https://forums.phpfreaks.com/topic/165508-create-a-post-from-a-php-script-not-html/ Share on other sites More sharing options...
flyhoney Posted July 10, 2009 Share Posted July 10, 2009 You can use the PHP CURL library to make HTTP POST requests. Quote Link to comment https://forums.phpfreaks.com/topic/165508-create-a-post-from-a-php-script-not-html/#findComment-872939 Share on other sites More sharing options...
thebadbad Posted July 10, 2009 Share Posted July 10, 2009 You can post values to a remote script with cURL. Is insert_data.php the remote script? And what's foo4.php? You need to explain yourself better. Quote Link to comment https://forums.phpfreaks.com/topic/165508-create-a-post-from-a-php-script-not-html/#findComment-872941 Share on other sites More sharing options...
liderbug Posted July 10, 2009 Author Share Posted July 10, 2009 insert_data.php is part of a larger package (zen cart). In the larger schema the code runs thru files A,B,C,D,insertdata,F,G,(backto)A. So I wrote foo4 to take the place of "D" which will have the lines: $data = file("data.csv"); foreach($data.... call insert_data.php. I know it can be done - just a mater of getting all of the duck properly lined up. cal Quote Link to comment https://forums.phpfreaks.com/topic/165508-create-a-post-from-a-php-script-not-html/#findComment-873024 Share on other sites More sharing options...
aggrav8d Posted July 10, 2009 Share Posted July 10, 2009 You can also cheat by loading your values into an array called $_POST and then including "insert_data.php"... but I don't recommend it. Quote Link to comment https://forums.phpfreaks.com/topic/165508-create-a-post-from-a-php-script-not-html/#findComment-873025 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.