0

My objective is to send the data that is submitted in a html form to both a mysql database (already accomplished) and also to an external URL. The reason for sending to the url as well is to add the data to a automated dialler system for our call center.

The problem I have is I can't get my head around once the information is sent to the database, how to then send to a url, I currently have my PHP page send data to mysql and THEN to an email address.

An example of the url:

http://domain.com/vicidial/non_agent_api.php?source=test&user=****&pass=****&function=add_lead&phone_number=07777777777

Any help much appreciated.

0

1 Answer 1

1

You could use cURL to send HTTP request to certain url.

<?php

$ch = curl_init("http://domain.com/vicidial/non_agent_api.php?source=test&user=****&pass=****&function=add_lead&phone_number=07777777777");
curl_exec($ch);
curl_close($ch);
?>

Cant say for sure if above snippet works, because I dont have PHP devenviroment right now, but that should be the basic idea to be able to send data to another url.

More help: http://www.php.net/manual/en/book.curl.php

Sign up to request clarification or add additional context in comments.

4 Comments

thought that would work but I got an error, i think it was something to do with having that code plus sending the user to a thank you page? here is the error: Cannot modify header information - headers already sent by...
Do you use php header()-function? The error may come from that the PHP have already outputted data. Do you have any prints or echos in your script?
Do you have any html, prints or echos etc. Before that?
Does the CURL part work? Can you remove the header() part and test that if CURL works. I have read that error: Cannot modify header information could come also from cURL, from php safe_mode or basedir settings to be exact.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.