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); 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)); Link to comment https://forums.phpfreaks.com/topic/150967-php-curl-help-please/#findComment-793165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.