-3

I need to send some form data (POST) to a URL.

But I do not wish my script go to her.

I have a list of users in the database, I need to spend http://www.somesite.com/receive

Except that my script can not go there.

It would be possible to make a POST request without leaving the page? (without using the Ajax).

Something like CURL?

1
  • You can use curl on the server side and ajax on the client side. Commented May 17, 2014 at 6:24

1 Answer 1

3

Your question is a little hard to understand. If I had enough rep, I would ask clarification in a comment, but I can't.

Do you simply want to use curl to send an HTTP POST request? If so, you can use PHP's curl functions, making sure to set CURLOPT_POST to true. This code is from another question:

$ch = curl_init();
$curlConfig = array(
    CURLOPT_URL            => "http://www.example.com/yourscript.php",
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS     => array(
        'field1' => 'some date',
        'field2' => 'some other data',
    )
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);

// result sent by the remote server is in $result

Here are some more references.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.