Without using forms and hidden variables, how to send
variables from a PHP script to another URL using POST
method?
Answer Posted / lakhan lal
you can do it using curl
example:
<?
$URL="www.mysite.com/test.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://$URL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,
CURLOPT_POSTFIELDS, "Data1=blah&Data2=blah");curl_exec
($ch);
curl_close ($ch);
?>
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
Why ide is recommended for use while programming with php?
What are php keywords?
Explain Booleans in PHP?
Which function is used to strip whitespace?
How many days will it take to learn php?
What is input sanitization in php?
What is the use of mysql_real_escape_string in php?
Is array a key php?
What is pdo classes?
Why print_r is used in php?
What the use of var_dump()?
Who is the father of php and what is the current version of php and mysql?
What is the use of imagetypes() method?
What is php7?
Explain a resource?