gecata83 0 Newbie Poster

Ok I'm having a problem with this code. The problem occures when I set the POST request and alert me with 411 error. Without this two lines

curl_setopt($session,CURLOPT_POST,true);
			curl_setopt($session,CURLOPT_POSTFIELDS,$xml)

this code output nice xml which shows all the info in my spreadsheet. With this two lines we should put in the spreadsheet new row but instead error occur CAN SOMEONE HELP

public function addRowToSpreadsheet(){
		$xml  = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended">';
				 
		$xml .=	"<gsx:asdf><![CDATA[joro]]></gsx:asdf><gsx:asdf_2><![CDATA[boris]]></gsx:asdf_2>" ;
  		$xml .= "<gsx:asdf_3><![CDATA[karlo]]></gsx:asdf_3></entry>";
		
  		
		$id_spread = "tcgrYU18lLwwgQU4o0abnDA";
		$id_person = "tqzJliShRuVtAuFOProgevw";
		$key = $this->personInfoKEY;
		$session = curl_init();
		$headers = array(
                                        "Content-Type: application/atom+xml",
                                        "Authorization: GoogleLogin ".$this->authVar,
                                        "GData-Version: 3.0 "
                                );
			curl_setopt($session,CURLOPT_URL,"https://spreadsheets.google.com/feeds/list/$id_spread/1/private/full");
			curl_setopt($session,CURLOPT_SSL_VERIFYHOST,0);
			curl_setopt($session,CURLOPT_SSL_VERIFYPEER,0);
			curl_setopt($session,CURLOPT_RETURNTRANSFER,true);
			//curl_setopt($session,CURLOPT_HTTPHEADER,array("Content-type: application/json"));
			curl_setopt($session,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);
			curl_setopt($session,CURLOPT_HTTPHEADER,$headers);
			curl_setopt($session,CURLOPT_POST,true);
			curl_setopt($session,CURLOPT_POSTFIELDS,$xml);

			$remote_file_Auth = curl_exec($session);
		
		$result = curl_exec($session);
		$status = curl_getinfo($session,CURLINFO_HTTP_CODE);
		$text = curl_error($session);
		curl_close($session);
		echo $status." - ".$text;
		if($fo=fopen("rowListFeedSpreadsheet.xml",'w')){
			echo fwrite($fo,$result);}
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.