paddy_fields Posted March 27, 2014 Share Posted March 27, 2014 (edited) I've made a CMS with a form that allows jobs to be posted to my database. I also want the job to be posted to 'reed.co.uk', a UK job board simultaneously. In their documentation the only way to post 'automatically' ie not via their site is by sending a POST request to their specified URL I want this to happen via the php processing MY form into MY database, and not have the user have to fill out another form (the reed version) with the same data. From a blitz of Google it looks like CURL can be used to automatically send POST data, like in the code below; <?php $ch = curl_init(); $data = array('name' => 'phpnoob', 'address' => 'somewhere'); curl_setopt($ch, CURLOPT_URL, 'http://localhost/url/to/your/php/form.php'); // use the URL that shows up in your <form action="...url..."> tag curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); ?> Is this the right solution for this? I could have the CURL code on the same PHP page that inserts the data into my own database right? Any pointers would be very much appreciated, I've never worked with CURL before., Before I get down to writing it it would be nice to know I'm on the right track! For reference the Reed instructions are here: http://www.reed.co.uk/recruiter/uploadreference Edited March 27, 2014 by paddyfields Quote Link to comment https://forums.phpfreaks.com/topic/287331-using-curl-to-post-data/ Share on other sites More sharing options...
Solution trq Posted March 27, 2014 Solution Share Posted March 27, 2014 Is this the right solution for this? I could have the CURL code on the same PHP page that inserts the data into my own database right? Yes and Yes. Quote Link to comment https://forums.phpfreaks.com/topic/287331-using-curl-to-post-data/#findComment-1474104 Share on other sites More sharing options...
paddy_fields Posted March 27, 2014 Author Share Posted March 27, 2014 Web five. Quote Link to comment https://forums.phpfreaks.com/topic/287331-using-curl-to-post-data/#findComment-1474109 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.