{"code":5,"message":"Invalid URL Passed"}
My Code is as follows...
public function zoho_email($array){
$data = json_decode($array,true);
$url = '/invoices/'.$data['invoice']['invoice_id'].'/email';
//echo "<pre>"; print_r($data);die;
$recivers[] = array($data['invoice']['contact_persons_details'][0]['email']);
$data = array(
'to_mail_ids' => $recivers,
'subject' => 'Invoice from MSL (Invoice#: '.$data['invoice']['invoice_number'].')',
'body' => 'Dear Customer,<br><br><br><br>Thanks for your business.<br><br><br><br>The invoice '.$data['invoice']['invoice_number'].' is attached with this email.You can choose the easy way out and <a href="https://books.zoho.com/SecurePayment?CInvoiceID=d">pay online for this invoice.</a><br><br>Here’s an overview of the invoice for your reference.<br><br><br><br>Overview:<br><br>Invoice # : '.$data['invoice']['invoice_number'].'<br><br>Date : '.date('M d, Y').'<br><br>Amount : '.$data['invoice']['sub_total'].'<br><br><br><br>was great working with you. Looking forward to working with you again.<br><br><br>\nRegards<br>\nMSL<br>\n',
'send_from_org_email_id' => true
);
//$data = array('contacts' => $contacts);
$result = $this->zoho_create($url, $data);
echo "<pre>"; print_r($result);die;
}
public function zoho_create($url,$array){
$json = json_encode($array);
$data = array('authtoken' => ZOHOAUTHTOKEN,'JSONString' => $json,'organization_id' => ZOHOORGNISATIONID);
//echo "<pre>"; print_r($data);die;
$curl = curl_init($this->apiUrl.$url);
if($url=='contacts/'){
curl_setopt_array($curl, array(
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true
));
}
else{
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POST, TRUE);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json") );
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded") );
}
$response = curl_exec($curl);
curl_close($curl);
//var_dump($response);die;
return $response;
}
Please Help me...