Find Jobs
Hire Freelancers

Log API call inside file

€8-30 EUR

Completed
Posted over 3 years ago

€8-30 EUR

Paid on delivery
We have this code which calls to an API function, we would like to log all requests to a file (in a secure way). We can handle multiple requests at once. Code works smooth on production environment, we need to log calls to a file to verify which call made which error. $userId = $current_user->ID; $idRichiesta = $[login to view URL](100000,999999); $timestamp = round(microtime(true) * 1000); $terminalid = get_user_meta($userId,'billing_wcj_checkout_field_3'); $codPv = get_user_meta($userId,'billing_wcj_checkout_field_2'); $url = $domain; $piva = get_user_meta($userId,'billing_wcj_checkout_field_1'); $servizio = 'EC'; $request = array('grant_type' => 'client_credentials','client_id' => '**','client_secret' => '**'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "**"); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request)); curl_setopt($ch, CURLOPT_SSLCERT, $_SERVER['DOCUMENT_ROOT'].'/../../csr/**'); $response = curl_exec($ch); $responseObj = json_decode($response); $accessToken = $responseObj->access_token; $request = array('timestamp'=>$timestamp,'idRichiesta'=>$idRichiesta[0],'terminalid'=>$terminalid[0],'codPv'=>$codPv[0],'url'=>$url,'piva'=>$piva[0],'servizio'=>$servizio); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "**"); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_VERBOSE, true); $authorization = "Authorization: Bearer ".$accessToken; curl_setopt($ch, CURLOPT_HTTPHEADER, array($authorization,'Content-Type: application/json')); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request)); curl_setopt($ch, CURLOPT_SSLCERT, $_SERVER['DOCUMENT_ROOT'].'/../../csr/**'); $response = curl_exec($ch); $responseObj = json_decode($response); if($responseObj->esito=='OK') { $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() ); if ( is_wp_error( $blog_id ) ) { return false; } confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); $blogUrl = get_blog_option($blog_id,'siteurl'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $blogUrl.'/wp-admin/[login to view URL]'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, array('action'=>'latepoint_activate')); curl_exec($ch); $tablePrifix = $wpdb->get_blog_prefix($blog_id); $wpdb->insert($tablePrifix.'latepoint_settings', array("**'))); $wpdb->insert($tablePrifix.'latepoint_settings', array("name"=>"**'))); $wpdb->insert($tablePrifix.'latepoint_settings', array("name"=>"**'))); $wpdb->insert($tablePrifix.'latepoint_settings', array("name"=>"**'))); $wpdb->insert($tablePrifix.'latepoint_settings', array("name"=>"**'))); return true; } else { $errorMsg["1"] = "ERROR 1"; $errorMsg["2"] = "ERROR 2"; $errorMsg["3"] = "ERROR 3"; $errorMsg["4"] = "ERROR 4"; $errorMsg["99"] = "ERROR 99"; $errors->add('error',$errorMsg[abs($responseObj->codiceEsito)]); signup_another_blog( $blogname, $blog_title, $errors ); return false; }
Project ID: 27194750

About the project

4 proposals
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello, I have gone through your project description and I can confirm that l am deem fit to deliver it as expected. I am a senior web developer with plenty of experience and creativity. Kindly contact me so that we can discuss more on the specifics. Thank you
€21 EUR in 1 day
4.9 (30 reviews)
4.6
4.6
4 freelancers are bidding on average €28 EUR for this job
User Avatar
Hi, I am a full stack LAMP Web app and API Web developer with 6 + years of expertise in the field and looking at your requirements I can assure you that consider the requirements to be fulfilled and consider it done once you assign it to me Looking forward towards working for you with my expertise Thanks, Somnath Paul.
€30 EUR in 1 day
4.9 (9 reviews)
3.0
3.0

About the client

Flag of ITALY
San Mauro Pascoli, Italy
5.0
24
Payment method verified
Member since Feb 15, 2018

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.