Sunday, 14 June 2020

Gradle JSP Quick Setup Tutorial | JAVA & Groovy Language | Web Application



Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

Official Gradle JSP Guidelines:-
https://guides.gradle.org/building-java-web-applications/

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In this video, I shall create JSP application using gradle in the quickest way possible.
There are plenty of tutorials available on internet for installing gradle and java, so we shall skip that part.
There is an official document from gradle to setup JSP. That link is given in the description.
There are requirements that you should have.

Configuring basic JSP doesn’t require more than 5 minutes.
And we are using groovy as a build.

First instruction is to create folder structure like this.
Open the file system or my computer, I already created a TUTORIAL folder, go inside it and start to create new folders.

Now come to home folder, which is webdemo, and create a new file “build.gradle”.

Click on GROOVY tab if kotlin is selected by default.

Next, open webdemo folder in terminal or command prompt.

Even though the gradle version is greater than 4.10, don’t use that wrapper.

type the same command as they provided.

It will create some files and folders inside webdemo.

Now, create more folder as they told you, and create HelloServlet.java file inside that folder.

There are the number which indicates what is the purpose of that code.

Now come back to webapp folder and create two new files, index.html and response.jsp.

Copy paste the code in index.html.

copy paste the code in response.jsp.

Now, copy this id and paste it in plug in.

After that, go to terminal and type the command they provided.

It will provide a URL. Copy that and paste it in browser.

If you click on hello, the GET method is called.

Force refresh it.

To access JSP, type name and click on button.

So, that is it. The core JSP is ready.

Required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching. 


Monday, 8 June 2020

Java Google Calendar API | Linux Terminal & Gradle Groovy | Display Events | Fix redirect_uri_mismatch



You can download library from:- https://unpossiblepog.com/research-and-development/GRADLE+JAVA/Google-Gradle-API-In-Java-For-Google-Drive-And-Google-Calendar

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

Official Google Developer page for google calendar JAVA API:-
https://developers.google.com/calendar/quickstart/java

Google Console  page:-
https://console.cloud.google.com/

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In this video, I shall make a connection between Google calendar and JAVA using gradle and display events in terminal or Command prompt.

Following operation requires Linux as it provides more flexibility for performing tasks.

Output can later be used in any framework like Spring, JSP, hibernate etc.

Lets go to google and search “google calendar quickstart java” go to developers.google.com link.

Requirements :
1. Google account with google calendar enabled.
2. Linux OS (debian family). I am using LUBUNTU. install linux in vmware or virtualbox if you don’t have LINUX as BOOT OS.
3. JAVA JDK version 1.8 or grater.
4. Then, gradle version greater than or equals to 2.3.



For people who doesn’t know what is gradle, in simple words, it is a build-tool which has 2 types, Groovy and Kotlin. And both of them can use any language Syntax for its script.
Kotlin is mostly used for android development and has file extension of .gradle.kts but groovy is mostly is used for webserver and with extension .gradle.

We are going to use groovy build and JAVA.

Then lets go to calendar.google.com and create an event. The red line is the current time so make the event after that line.

Now open file system. Create a folder in home with any name in my case “GoogleCalendar”.
Open that folder in terminal.

I already installed Java and gradle but still, show you the commands to install them.
Sometimes, you get older version of gradle, so you can upgrade it by using this command.
Then click on enable Google Calender API button.
Select Web server, now, type same url as I showed you. make sure that C in callback is capital.
Click on CREATE.
Download configuration.
Remember that file can be renamed if same file name already exists.

Now, in our newly created folder, create another folder with name CALLBACK. C capital.
Now in terminal, go inside callback folder using cd command.

Check if you have installed java and gradle correctly with required version.

Now, type the command they provided.

Type 1. To select Groovy.
For second question, don’t type anything, press enter directly.

Now if you check folder, some folders & files were automatically created.

Now paste the second command, which will create more folder in your project.

As per instructions, copy-paste credentials.json file from downloaded folder to this path.

Make sure to rename as credentials.json if name is different.

Next instruction is to copy-paste the gradle code in build.gradle file.

After that we have to create a java file at location as they told us.

Paste the code in it.

Here, remove “_READONLY” if you also want to change calendar events in future.

Now lets run the command “gradle run”.

It shall directly open the link in browser, but there is an error called “redirect_uri_mismatch”.

So to solve that, first cancel process by pressing ctrl+c in terminal.

Go to google console.

Left-top-menu, APIs & Services, and select credentials.

As you can see, the top Client Id is what we created on 7th of june, click on it, add URI, make sure to make same configuration as I do.

If you see in java code, the port number is 8888. So change that port in configuration.

Also, go to main callback folder and inside tokens folder, delete the file.
Lets clear the terminal and rerun the command.
It automatically opens the link in browser and you can see this page.
Select your google account,  click on advanced, go to quickstart unsafe, Allow.

You will see this message.
Now if you see it in terminal, you will see the upcoming event that we created at the beginning.
Lets rename it to verify. You can also create multiple events that will not be a problem for program to execute.

Now you can close terminal, and rename the folder.
Now open the renamed folder in terminal with same command and there will not be any problem in future.

In next tutorial, I shall show you how to get all events and display them on browser using JSP framework through gradle.

Required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching. 


Monday, 1 June 2020

JAVA Tutorial | Easiest Way To Get List Of Dates Between Two Dates






Code :-


import java.text.SimpleDateFormat;
import java.util.*;

public class DateList {
   
    public static void main(String[] args) throws Exception {
        String from="2020-01-01";
        String to="2020-05-30";
       
        Date d_from = new SimpleDateFormat("yyyy-MM-dd").parse(from);
        Date d_to = new SimpleDateFormat("yyyy-MM-dd").parse(to);
       
        //System.out.println(d_from.getTime());
       
        long t1=d_from.getTime();
        long t2=d_to.getTime();
       
        SimpleDateFormat f=new SimpleDateFormat("yyyy-MM-dd");
       
        if(t1<t2)
        {
            //1 = 1000
            for(long i=t1;i<=t2;i+=86400000)
            {
                System.out.println(f.format(i));
            }
        }
       
    }
   
}


------------------------------------------------
Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------


Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In this video, I shall show you the easiest way to get list of dates between two dates in JAVA.
Here I am using netbeans IDE and the date format as year-month and date.

 I shall be converting string to date by using date and SimpleDateFormat classes.
With netbeans, you will be assisted to import required packages and handle exceptions.

However, I shall manually handle exception by throwing it in main function line.
Main strategy is to convert date into milliseconds.

Now using LONG as data type is important because the milliseconds are large numbers.
First thing I shall do is to verify if from-date is lesser than to-date by applying if statement.

Now, I shall use for loop, a variable start with from-date and stop at to-date.
In for loop, I shall add 1 day in milliseconds.
One day is 86400 second.
However, 1 second equals to 1000 milliseconds, so add more three zeros.

Let check the output.

Now, the only thing left is to convert milliseconds to date.
For that, SimpleDateFormat variable is required.
Use format function with 1 argument of milliseconds.

The JAVA code handles even a leap as you can see, 29 days in February. 2020 which is the worst year.

The code link is given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching. 


Thursday, 14 May 2020

QR Code Reader API | Using PHP And Linux OS And Xampp | Khanamiryan Github




QR Codes for testing


You can now download a whole API With VENDOR from:
https://unpossiblepog.com/codes/PHP/KHANAMIRYAN-QR-Code-Reader-For-PHP-version-7.2-And-Onward-With-Composed-Library

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

QR Code Github link:-
https://github.com/khanamiryan/php-qrcode-detector-decoder

GD library commands :- (first try without running those commands)
sudo apt-get install php5-gd
sudo apt-get install php7.0-gd
 sudo apt-get install php7.1-gd
sudo apt-get install php7.2-gd

LUBUNTU : Install, Launch & Uninstall Xampp | Install Sublime Text | Complete PHP Configuration:-
https://youtu.be/X09awd5Q8Bk

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In this video, you will learn how to integrate QR code reader on website using PHP.
In this case, I will be using khanamiryan’s github package because people on internet claims that
it is the purest form of QR Code reader.
(Link in the description.)
Requirement is any linux from Debian family with xampp installed and php version better than 5.6.
Download the package.
Put that in htdocs folder of xampp, extract it.
Make sure to change permission to make it editable for everyone.
Rename it if you want to.
Inside that folder, there is a readme file which provides same steps as given below in github link.
So go back to htdocs folder and open qr code’s folder in terminal.
Install composer by tying this command. --> sudo apt install composer
Then enter your password.

Now, I provided in descriptions, 4 commands of installing GD library for each PHP versions from 5.6 to 7.2.
I suggest you to skip installing GD library, and install only if the main command gives you an error.
Now I shall be executing main command as they described by copy-pasting it in terminal.
Now if you check inside folder, there is vendor folder downloaded.
I shall be creating index.php file in main folder.
Lets check if it is working.
Now add PHP tag and paste the code they provided.
echo the text variable.
Now I have some QR code images, I shall paste them in our folder.( I shall provide them in blog link given in description.)
And paste the file name here.
Now, if you execute, there will be an error like Class QrReader not found.
So to fix it, rename function as this. (Zxing\QrReader).
And now if you execute, it will display content hidden inside QR code.
Lets try different QR code.
Don’t forget to like, share and subscribe.
Thanks for watching. 


Monday, 4 May 2020

Google Sheet API | Part 3 | Delete Records From Spreadsheet | Remove Row...



Download VENDOR Folder (Only for PHP version 7.2+): https://unpossiblepog.com/research-and-development/php/Vendor-Folder-For-Google-Sheet-Drive-Calendar-With-PHP-Version-7.2-And-Onward

code :-

$requests = [
  new Google_Service_Sheets_Request([
      'deleteDimension' => [
          'range' => [
              'sheetId' => '0',
              'dimension' => 'ROWS',
              'startIndex' => 8,
              'endIndex' => 9
          ]
      ]
  ])
];

$batchUpdateRequest = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest([
    'requests' => $requests
]);

$response = $service->spreadsheets->batchUpdate($spreadsheetId, $batchUpdateRequest);
print_r($response);



------------------------------------------------

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

Google Sheet API | Part 1 | Connect And Display Sheet Data Using PHP | Latest:-
https://youtu.be/CI0xL93Xtpg

Google Update New Configuration :-
https://youtu.be/5COjnEc4d9E

DELETING ROW IMP Link #1:-
https://developers.google.com/sheets/api/samples/rowcolumn#delete_rows_or_columns

DELETING ROW IMP Link #2:-
https://developers.google.com/sheets/api/guides/batchupdate#example

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
This is the video of Deleting Rows in Google Sheet using API.
First, if you don’t know how to connect google sheet with PHP, then watch both videos.
Links of those tutorials are given in description.
Now, as you can see, the current code I have is to display data from google sheet on browser.
Also, I provided two links which are important for deleting rows.
First link is to understand the array structure for deleting.
Second link is a PHP code that we have to implement.
Now In a code, make sure that the scope is SPREADSHEETS and not SPREADSHEET_READONLY
Here, comment the code which fetches the data.
Copy the code from top up to response variable.
Paste it just below spreadsheetID variable.
Now, we actually need one GOOGLE SERVICE SHEETS REQUEST. So remove the second but be careful not to mess the structure.
We also don’t need FIELDS sub-array.
Open the array structure link.
So according to this, the first parent should be “requests” which is already given in code.
So we don’t need to change it.
The second parent is “DELETE DIMENSION”. Paste it.
Third is “RANGE”.
Now RNAGE has 4 key value pairs, so paste them one by one.
Now, the first key which is sheetID is not same as spreadsheetID.
But rather it is sub-sheet.
And it is denoted as GID which you can find in URL.
In my case, the GID is 0.
Now we are deleting rows, so paste ROWS.
Now in spreadsheet, there are numbers which are actual index that we are going to use.
Make sure not to use any quotes, just type numbers.
Also a side note is, startIndex 8 means it does not delete the 8th row, deleting will start
from 9th row up to 10th row.

So if we refresh and check sheet, you see that data from row 9 and 10 are deleted and the
rest were moved upward by 2 positions.
If you want to delete only 1 row that is 9th row, then type 9 at END-INDEX and type 8 at
START-INDEX.

Now the 9th row is deleted.
You can also copy the whole code from blog link which is given in the description.

Don’t forget to like, share and subscribe.
Thanks for watching. 



Wednesday, 22 April 2020

Azure SAML 2.0 With PHP Login API | SimpleSAMLPhp | Login With Microsoft...




### Make sure to create index.php file inside your (renamed)folder. ###

index.php code :-

<?php
require_once 'lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('default-sp');
$as->requireAuth();

$attributes = $as->getAttributes();

echo '<pre>';
print_r($attributes);
echo '</pre>';

$url = $as->getLogoutURL();
echo '<a href="' . htmlspecialchars($url) . '">Logout</a>';

?>

------------------------------------
Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

Azure Tutorial | Login Using Microsoft Azure Active Directory And PHP | Single Sign On ( SSO ):
https://youtu.be/IbJt7tr8kL0

Azure Link:
https://portal.azure.com/

SimpleSAMLphp Download Link:
https://simplesamlphp.org/

SimpleSAMLphp install documentation:
https://simplesamlphp.org/docs/stable/simplesamlphp-install

List Of Timezones:
https://www.php.net/manual/en/timezones.php

Index.php Code Link:


Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
This tutorial is about about Microsoft Azure’s SAML coonection with PHP.
Previously I made tutorial about Azure’s Simple SSO. You can check that out if you want to.
The Objective of SAML and Simple SSO tutorial is the same, that is to login using Microsoft account. But there is a huge difference between the approaches and security they provide.
1st is, Simple Single Sign On (SSO) is just a procedure where you can perform login operation. But SAML is a language which has similar structure as XML. That XML then helps to generate a configuration. Developers had to store those configuration in code or in database so that user can login later. You will understand that at the end of tutorial.
2nd is, in Simple SSO, anyone with microsoft email account can perform login. But in SAML, you can decide who which user can login.
3rd is, In Simple SSO, you must have original microsoft email account like xyz@outlook.com, but in SAML you can create subdomain account. For example, if your email address is abc@outlook.com and if your friend “DEF” doesn’t have any email account, you can create his email as def@xyz.microsoft.com.
Which doesn’t exists as an email but can login in your web application. Here XYZ.microsoft.com becomes a subdomain for your friend’s id.

4th is You can use Simple SSO for public websites like e-commerce or social media to create account by adding a button as LOGIN WITH MICROSOFT ACCOUNT, but SAML is mostly used
for private access websites like any admin sites or management systems where logins need restrictions.

There are few requirements for SAML implementation
1. At least 1 microsoft email account.
2. LINUX or Windows Operating systems with XAMPP  installed. (Just for testing)
3. LINUX hosted live website with SSL implemented and with an access of CPANEL, WHM or FTP (eg filezilla).
4. Linux Operating system (with zip compressor) or Windows OS (with WinRAR, or 7zip),

Lets jump to PORTAL.AZURE.COM.
I am using trial version which is available for 14 days max.
Go to top menu, and select Azure Active Directory, this AZURE ACTIVE DIRECTORY is IdP, means Identity provider which authenticates if user has permission to access website or not.
Go to enterprise application and then new application.
If you are using trial version, you will see something like this but in pink color, which says something about create a trial version or something like that. I don’t know, Just click on it and you click on “skip for now”.
Then this type of page will appear.
Click on “Create your own application”, Give any name,  click on “Integrate any other”.
Then create it and wait for around 20 seconds, they will redirect you on configuration page automatically.
Now we shall create users with subdomains for your friends, colleagues or clients.
Go to top menu, Azure Active Directory, then users. Create new user.
Click on show password.
Save the user id & password somewhere else.
Click on create.
I shall create another one to demonstrate how the SAML authentication works.
Lets go to enterprise application by clicking on side-menu, Azure Active Directory.
Enterprise Apps.
Select then app we created from the list.
Click on Set UP SINGLE SIGN ON.
Select SAML.
Now I have one website with SSL enabled.
Copy that path, go back to azure site, click on edit button of BASIC SAML Configuration.
Paste the link in, Entity ID and reply URL.
Actually, I shall just rename entity id, because you can give any name if you want to.
Then save it.
Don’t test it now because more configuration is yet to perform.
Now click on SAML Signing Certificate edit button.
then New Certificate, make sure to have same configuration as I have for signing option and algorithm.
Save it.
Now refresh the page.
The certificate configuration is generated automatically.
Now you can test it using your own main account.
As you can see even I don’t have any access right now.
Also notice that, in URL there is SAML2 written, means the restriction is provided by SAML module.
For that i shall go to “users and groups”, then “add user”, select a user from list.
I shall add myself.
Then,  go to single sign on, and click on test, and click on “sign in as current user”.
As you can see, I successfully redirected after logged it.
Now I shall give access to steve rogers sub-user.
And lets see if he gets an access or not.
First I shall try tony stark who doesn’t have an access.
Click on “Sign in as someone else”.
But even then it gives me direct access to this site so click on “use a different account”.
They ask me to change password because we are using default password.
But still it will not redirect me.
Lets try using steve rogers account.
And you see, that it redirects me.
Now copy logout URL and paste it in URL browser to logout from any account.
Now lets jump to PHP code.
Go to google and search “simpleSAMLphp”
Go to website, click on download.
Make sure not to download from GITHUB as they don’t provide vendor folder which is required for login.
Download the latest version from top link which is has the extension of tar.gz which is compressed version like .rar or .zip file
Now go to “documentation”, and click on “Using SimpleSamlphp as SAML service provider”.
this is just a documentation although you should avoid it because it tells you to make virtual host on your computer which doesn’t help at all.
But if you are using LINUX OS, then execute this command in terminal.
Go to the folder where you downloaded it.
Go back and open that folder in terminal.
type tar then space, then xzf then space then type the filename. Hint,is just type first few letters of that downloaded file and press tab it will automatically paste it’s name.
Then we have to rename this file to any name by using MV command.
If you are using windows OS, then just extract that folder using winrar or 7zip and rename that folder to anything you want.
You can ignore the rest of the information.
I am using sublime text for text-editor. You can use notepad ++ or netbeans etc.
If you see inside it, there is a vendor folder which has libraries.
Open xampp and try to access the project using localhost.
As you can see there is an error, also notice that it automatically redirect so somewhere else.
Open the file config.php which is  inside config folder.
Re-write the baseurlpath.
First add the folder name that we renamed, in my case, it was unpossible_2, then www.
Save it.
Let’s again try to access website and you see that there is no error even when it auto-redirects.
Now we are ready to implement it on live server.
Compress this folder.
Upload it in live website via cpanel or you can upload whole folder through FTP without compressing it.
But will take a lot of time to upload file via FTP. Choice is yours.
After uploaded, extract that file.
Now lets go to azure website. and in application configuration, click on “edit button” of BASIC SAML config.
Now paste that extra path in reply url. which is your website, then your folder, then www.
Save it.
Then copy the whole URL.
Go inside that folder and open config folder.
Then open config.php.
Here paste that path we copied.
Scroll down, and add any timezone you prefer.
add any random password.
Save it.
Then lets access that URL.
And you will see that it redirects.
Click on configuration tab.
Everything is working.
Now go to cpanel, and open authsources.php file.
Now go to azure site and copy entity id.
Copy it and paste it in code.
Then copy azure AD identifier and paste it in Idp value.
Now lets refresh website.
Go to authentication tab, click on “test configured authentication sources”,then click on admin.
Type the password that we gave in config file.
Now again access www folder.
Go to federation tab.
Click on XML to SImpleSAMLPHP metadata converter.
Here you have to add xml file.
so go to azure site and save the xml file.
Browser that downloaded XML file and click on parse.
Now scroll down.
Here the provide you the PHP code and tell us to paste it in “samp20-idp-remote” file.
Copy this code
Go to cpanel.
Go inside metadata, and find the file “samp20-idp-remote” .
Open it.
and paste that code in this file. close php tag.
save it.
No again access www folder on browser.
Click on authentication tab.
Click on “test configured authentication sources”.
then default-sp.
You will be redirected to login.
Once logged in, you will see yours details like email ID, name etc.
And there is a logout button too.
Click on it to logout from current account.
Lets try that again using incorrect account.
Let try using correct account.
Now it is very lengthy to fetch out required info from Default user interface they provided.
So I made a manual code to directly get the file.
Link of that code is given in the description.
Add that in index file.
Also in azure configuration, change the reply url path, just remove /www.
Paste index.php file inside your folder.
Lets access that index.php file.
And you will see that code is now displaying that data in array.
You can get any data and push it in SESSION to maintain login.
Also there is a logout button at the bottom.

Don’t forget to like, share and subscribe.
Required links are given in the description.
Thanks for watching. 


Tuesday, 14 April 2020

Google API Update Alert 1 | Google Sheet And Google Calendar With PHP | ...




Download VENDOR Folder (Only for PHP version 7.2+): https://unpossiblepog.com/research-and-development/php/Vendor-Folder-For-Google-Sheet-Drive-Calendar-With-PHP-Version-7.2-And-Onward

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------

Google Sheet API | Part 1 | Connect And Display Sheet Data Using PHP | Latest:
https://youtu.be/CI0xL93Xtpg

Google Sheet API | Part 2 | Create New Sheet | Add & Update Cell Values:
https://youtu.be/X9h47ht-NnY

Google Sheet API | Part 1 | Connect And Display Sheet Data Using PHP | Latest:
https://youtu.be/Q-498CAa1xE

Google Calendar API Tutorial #2 | Access Different Calendars Using PHP:
https://youtu.be/9FfWnfpx9Kw

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
Google recently added some extra steps, for security reasons, while we create credentials for developing APIs for PHP.
It is making direct impact on my 4 tutorials on GOOGLE APIs which are on google sheet and calendar so I had to make this video as soon as possible.
Plus the process has a huge bug. I shall tell you how to bypass that bug and make the code work.
In this case I am using google sheet, but steps are similar for google calendar too.
Here you will see that, I created a folder in HTDOCS of xampp.
If you go to quickstart, and click on enable API, there is an extra INPUT you have to do. For my 4 tutorials, you have to select “web server”, and give the path which is for security reason so that no other website will access same API and code.
I am using localhost just for testing, and folder name as “google_update”, make sure to have same folder on both sides, and I shall give the name as quickstart.php. You will see that quickstart file later.
Download the credentials.
Paste it in that newly created folder.
Open that folder in terminal.
execute the command they provided.
Once done, copy the php code, create a new file as quickstart.php in our folder. Paste the code.
Make changes as same as I do in that code.
In terminal, make sure you are in that folder, then execute this command.
When clicked on “ALLOW”, you will see a huge bug.
The output was supposed to be like this. but, they provide you verification code in URL.
This change was done by google in coronavirus quarantine so it is possible they they didn’t get time to test it.
I understand that they are human too, they will fix it.
If you observe, the process directly executed the file.
So just copy the verification code and paste it in terminal.
hit enter. And you will be connected with API.
Now what you can do is comment those lines and then execute file in browser.
You can execute it without any request variables.
Sometimes you get error like this for token.json which says “file_put_contents(token.json), permission deined”
So just go to it’s properties and make it executable for everyone by changing the permission.
Now you can continue watching my tutorials.
Don’t forget to like, share and subscribe.
Required links are given in the description.
Thanks for watching.