Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

curl init function not working

curl init function not working  using -'php,lampp'

Hi I tries PHP Post Request inside a POST Request thinking it might be useful to me and my code is given below

$sub_req_url = "http://localhost/index1.php";

$ch = curl_init($sub_req_url);
$encoded = '';

// include GET as well as POST variables; your needs may vary.
foreach($_GET as $name => $value) {
  $encoded .= urlencode($name).'='.urlencode($value).'&';

foreach($_POST as $name => $value) {
  $encoded .= urlencode($name).'='.urlencode($value).'&';

// chop off last ampersand
$encoded = substr($encoded, 0, strlen($encoded)-1);

curl_setopt($ch, CURLOPT_POSTFIELDS,  $encoded);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);

form the index.php file and index2.php is another file in the same directory and when i open the page i get the following error in my error.log file

[Sat Dec 18 15:24:53 2010] [error] [client ::1] PHP Fatal error:  Call to undefined function curl_init() in /var/www/testing1/index.php on line 5

What i want to do is I have a reservation form that send post request and then i want to process post values and send again post request to paypal

asked Sep 30, 2015 by vickeykumar66
0 votes

Related Hot Questions

Government Jobs Opening