mdannatt Posted March 24, 2009 Share Posted March 24, 2009 I am trying to use cUrl to send variable $startdate and its value to a new php page. can someone tell me what to change to get it to work please? $url = "localhost/pod/mypage2.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://$URL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "startdate=$startdate"); curl_exec ($ch); curl_close ($ch); Quote Link to comment https://forums.phpfreaks.com/topic/150967-php-curl-help-please/ Share on other sites More sharing options...
MadTechie Posted March 24, 2009 Share Posted March 24, 2009 it looks fine to me, apart from the fact $startdate isn't set! also maybe try changing curl_setopt($ch, CURLOPT_POSTFIELDS, "startdate=$startdate"); to curl_setopt($ch, CURLOPT_POSTFIELDS, array("startdate"=>$startdate)); Quote Link to comment https://forums.phpfreaks.com/topic/150967-php-curl-help-please/#findComment-793165 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.