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
What are the advantages of triggers?
Tell me how can we pass the variable through the navigation between the pages?
How is a constant defined in a PHP script?
Where are the persistent cookies stored on your computer?
What is a composer?
How is it possible to remove escape characters from a string?
What is php namespace?
How does html form submit work?
How to create a session? How to set a value in session? How to remove data from a session?
What is an anti csrf token?
What is print_r?
How to include variables in double-quoted strings?
What is php form validation?
How does php work?
How to create a session? How to remove data from a session?