<?
add_action('wpcf7_before_send_mail', 'save_form' );
function save_form( $wpcf7 ) {
global $wpdb;
/*
Note: since version 3.9 Contact Form 7 has removed $wpcf7->posted_data
and now we use an API to get the posted data.
*/
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$submited = array();
$submited['title'] = $wpcf7->title();
$submited['posted_data'] = $submission->get_posted_data();
}
$data = array(
'name' => $submited['posted_data']['name'],
'email' => $submited['posted_data']['email']
);
}
class CB24{
// выполнить метод rest api
function method($auth, $method, $params){
$c=curl_init('https://'.$auth['DOMAIN'].'/rest/'.$method);
$params["auth"]=$auth['AUTH_ID'];
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
curl_setopt($c,CURLOPT_POST,true);
curl_setopt($c,CURLOPT_POSTFIELDS,http_build_query($params));
$response=curl_exec($c);
$response=json_decode($response,true);
return $response;
}
}
$CB24 = new CB24;
$cur_deal = $CB24->method($_REQUEST,'crm.lead.add.json',array(
'fields'=>array(
"TITLE" => 'test',
)
)
);
echo "<pre>";
print_r($cur_deal);
echo "</pre>";
<?
function DownloadCriteriaReportExample(AdWordsUser $user, $id, $start,$end) {
$user->LoadService('ReportDefinitionService', 'v201603');
$selector = new Selector();
$selector->fields = array('CampaignId','CampaignName', 'Impressions', 'Clicks','Ctr', 'Cost', 'StartDate');
$reportDefinition = new ReportDefinition();
$reportDefinition->selector = $selector;
$reportDefinition->reportName = 'Criteria performance report #' . uniqid();
$reportDefinition->dateRangeType = 'CUSTOM_DATE';
$startDate = $start;
$endDate = $end;
$selector->dateRange = new DateRange($startDate, $endDate);
$reportDefinition->selector = $selector;
$reportDefinition->reportType = 'CAMPAIGN_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'CSV';
// $reportDefinition->includeZeroImpressions = false;
$options = array('version' => 'v201603');
$filePath = dirname(__FILE__).'/upload/'.$id.'.csv';
ReportUtils::DownloadReport($reportDefinition, $filePath, $user, $options);
}