<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learn PHP Tutorial - Cody Paste</title>
	<atom:link href="https://www.codypaste.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codypaste.com/category/php/</link>
	<description>THE WEB PLAYGROUND</description>
	<lastBuildDate>Mon, 06 Jan 2025 10:29:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.codypaste.com/wp-content/uploads/2022/12/cropped-codypaste-32x32.png</url>
	<title>Learn PHP Tutorial - Cody Paste</title>
	<link>https://www.codypaste.com/category/php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Random Unique Number in CI3</title>
		<link>https://www.codypaste.com/random-unique-number-in-ci3/</link>
					<comments>https://www.codypaste.com/random-unique-number-in-ci3/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 06 Jan 2025 10:29:53 +0000</pubDate>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1263</guid>

					<description><![CDATA[<p>Random Unique 6 digit number generation in CI3 [crayon-69905ba1734a6336720974/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/random-unique-number-in-ci3/">Random Unique Number in CI3</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Random Unique 6 digit number generation in CI3</p><pre class="urvanov-syntax-highlighter-plain-tag">public function generateCoupon($numCoupons = 32500) {
        // Define allowed characters for alphabet and digits
        $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $digits = '0123456789';
        $alphaLength = strlen($alphabet);
        $digitLength = strlen($digits);

        // Coupon amount distribution
        $amountDistribution = [
            500 =&gt; 2000,  // 2000 coupons with amount 500
            200 =&gt; 5000,  // 5000 coupons with amount 200
            100 =&gt; 7000,  // 7000 coupons with amount 100
            50  =&gt; 18500  // 18500 coupons with amount 50
        ];

        // Prepare the data for batch insert
        $insertData = [];
        $couponCount = 0;
        $coupons = [];

        // Loop through each amount distribution
        foreach ($amountDistribution as $amount =&gt; $count) {
            for ($i = 0; $i &lt; $count; $i++) {
                // Generate a unique coupon code in the format AAA111
                $couponCode = '';
                while (true) {
                    // First 3 characters: Alphabetical
                    $couponCode = '';
                    for ($j = 0; $j &lt; 3; $j++) {
                        $couponCode .= $alphabet[rand(0, $alphaLength - 1)];
                    }

                    // Last 3 characters: Numeric
                    for ($k = 0; $k &lt; 3; $k++) {
                        $couponCode .= $digits[rand(0, $digitLength - 1)];
                    }

                    // Check if the coupon code is unique
                    if (!in_array($couponCode, $coupons)) {
                        // Add unique coupon to the list and exit while loop
                        $coupons[] = $couponCode;
                        break;
                    }
                }

                // Prepare data for batch insert
                $insertData[] = [
                    'coupon' =&gt; $couponCode,
                    'amount' =&gt; $amount,
                    'expire_date' =&gt; date('Y-m-d'), // Set expire_date to today's date
                    'status' =&gt; 1
                ];

                $couponCount++;

                // Optional: Break early for testing purposes
                if ($couponCount &gt;= $numCoupons) {
                    break 2; // Break out of both loops
                }
            }
        }

        // Insert coupons in batches (chunk size of 500 or smaller to avoid memory issues)
        $chunks = array_chunk($insertData, 500);
        foreach ($chunks as $chunk) {
            $this-&gt;db-&gt;insert_batch('coupon', $chunk); // Insert the current chunk
        }

        echo count($insertData); // Return the number of coupons inserted
    }</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/random-unique-number-in-ci3/">Random Unique Number in CI3</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/random-unique-number-in-ci3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Increase file upload size phpMyAdmin</title>
		<link>https://www.codypaste.com/increase-file-upload-size-phpmyadmin/</link>
					<comments>https://www.codypaste.com/increase-file-upload-size-phpmyadmin/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Tue, 17 Dec 2024 11:36:56 +0000</pubDate>
				<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1251</guid>

					<description><![CDATA[<p>Step-By-Step Instructions 1. Login to WHM as the root user. 2. Navigate to &#8220;&#8221;Home / Server Configuration / Tweak Settings&#8221;&#8221; in WHM. 3. Click on the PHP tab. 4. For the &#8220;&#8221;cPanel PHP max upload size&#8221;&#8221; option, increase the upload limit to your desired value. a. Values higher than 2047MB are not permitted. 5. For &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/increase-file-upload-size-phpmyadmin/" class="more-link">read more<span class="screen-reader-text"> "Increase file upload size phpMyAdmin"</span></a></p>
<p>The post <a href="https://www.codypaste.com/increase-file-upload-size-phpmyadmin/">Increase file upload size phpMyAdmin</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Step-By-Step Instructions<br />
1. Login to WHM as the root user.</p>
<p>2. Navigate to &#8220;&#8221;Home / Server Configuration / Tweak Settings&#8221;&#8221; in WHM.</p>
<p>3. Click on the PHP tab.</p>
<p>4. For the &#8220;&#8221;cPanel PHP max upload size&#8221;&#8221; option, increase the upload limit to your desired value.</p>
<p>a. Values higher than 2047MB are not permitted.</p>
<p>5. For the &#8220;&#8221;cPanel PHP max POST size&#8221;&#8221; option, increase the POST value to the same or higher.</p>
<p>a. Values higher than 2047MB are not permitted.</p>
<p>6. Click Save.</p>
<p>Once this is done, you&#8217;ll see that phpMyAdmin now shows the new maximum upload size on the import screen next to the upload button.</p>
<p>The post <a href="https://www.codypaste.com/increase-file-upload-size-phpmyadmin/">Increase file upload size phpMyAdmin</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/increase-file-upload-size-phpmyadmin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Blob Image to PDF</title>
		<link>https://www.codypaste.com/blob-image-to-pdf/</link>
					<comments>https://www.codypaste.com/blob-image-to-pdf/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 25 Nov 2024 11:03:52 +0000</pubDate>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1227</guid>

					<description><![CDATA[<p>BluDart  API way bill response is in blob, so save it as PDF file inh a folder instead of storing in a database. I already stored in the database so I&#8217;ll show you how to save as PDF. [crayon-69905ba17c7e8777918729/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/blob-image-to-pdf/">Blob Image to PDF</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>BluDart  API way bill response is in blob, so save it as PDF file inh a folder instead of storing in a database.</p>
<p>I already stored in the database so I&#8217;ll show you how to save as PDF.</p><pre class="urvanov-syntax-highlighter-plain-tag">public function waybill_pdf_convert(){
	   
   $this-&gt;db-&gt;select('rmanumber, AWBPrintContent');
   $this-&gt;db-&gt;from('bluedart_response');
   $query = $this-&gt;db-&gt;get();
        
   $rows = $query-&gt;result();        
        if (!empty($rows)) {
            foreach ($rows as $row) {
                $rmanumber = $row-&gt;rmanumber; // Name of the file
                $blobData = $row-&gt;AWBPrintContent; // PDF binary data
        
                $fileName = FCPATH . 'bluedart-waybill/' . $rmanumber . '.pdf'; // File path
        
                // Write raw binary data directly to the file
                if (file_put_contents($fileName, $blobData)) {
                    echo "PDF file saved successfully: $fileName&lt;br&gt;";
                } else {
                    echo "Failed to save the PDF file: $fileName&lt;br&gt;";
                }
            }
        } else {
            echo "No records found in the database.";
        }
	}</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/blob-image-to-pdf/">Blob Image to PDF</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/blob-image-to-pdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Export Large Database in cPanel by SSH Command</title>
		<link>https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/</link>
					<comments>https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 18 Sep 2024 06:10:22 +0000</pubDate>
				<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1175</guid>

					<description><![CDATA[<p>To export a large MySQL database via the command line, you use the mysqldump utility. Here’s the basic syntax and steps for exporting a large database: Basic Syntax mysqldump -u username -p database_name &#62; /path/to/backup_file.sql Steps to Export a Large Database Open Your Terminal: Access the command line interface on your server or local machine. &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/" class="more-link">read more<span class="screen-reader-text"> "Export Large Database in cPanel by SSH Command"</span></a></p>
<p>The post <a href="https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/">Export Large Database in cPanel by SSH Command</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To export a large MySQL database via the command line, you use the <code>mysqldump</code> utility. Here’s the basic syntax and steps for exporting a large database:</p>
<h3>Basic Syntax</h3>
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u username -p database_name &gt; /path/to/backup_file.sql<br />
</code></div>
</div>
<h3>Steps to Export a Large Database</h3>
<p><strong>Open Your Terminal:</strong></p>
<p>Access the command line interface on your server or local machine.</p>
<ol>
<li><strong>Run the <code>mysqldump</code> Command:</strong>
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u your_database_user -p your_database_name &gt; /path/to/backup_file.sql</code><code class="!whitespace-pre hljs language-bash"></code></div>
</div>
<p>&nbsp;</li>
<li><strong>Enter the Password:<br />
</strong><span style="font-size: 1rem;">After running the command, you’ll be prompted to enter the password for </span><code>your_database_user</code><span style="font-size: 1rem;">. Type in the password and press Enter.</span></li>
</ol>
<h3>Additional Options</h3>
<ul>
<li><strong>Compress the Backup File:</strong> To save space, you can compress the SQL file using gzip:
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u your_database_user -p your_database_name | gzip &gt; /path/to/backup_file.sql.gz</code></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"></code></div>
</div>
<p>To decompress and restore later:<br />
<span style="background-color: #f2f4f5; color: #222222; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 0.9375rem;">gunzip &lt; /path/to/backup_file.sql.gz | mysql -u your_database_user -p your_database_name</span></li>
<li><strong>Include Specific Tables:</strong> If you want to export specific tables, list them after the database name:<br />
<span style="background-color: #f2f4f5; color: #222222; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 0.9375rem;">mysqldump -u your_database_user -p your_database_name table1 table2 &gt; /path/to/backup_file.sql</span></li>
<li><strong>Export Only the Schema:</strong> To export only the schema (structure) without data:
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="sticky top-9 md:top-[5.75rem]"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u your_database_user -p -d your_database_name &gt; /path/to/backup_schema.sql</p>
<p></code></div>
</div>
</li>
<li><strong>Export Only Data:</strong> To export only the data (without schema):
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u your_database_user -p --no-create-info your_database_name &gt; /path/to/backup_data.sq</code></div>
</div>
</li>
</ul>
<h3>Troubleshooting Tips</h3>
<ul>
<li><strong>Ensure Enough Disk Space:</strong> Make sure there’s enough disk space on your server or local machine to store the backup file.</li>
<li><strong>Handling Large Databases:</strong> For very large databases, consider using options like <code>--single-transaction</code> to avoid locking the tables:
<div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">mysqldump -u your_database_user -p --single-transaction your_database_name &gt; /path/to/backup_file.sql</p>
<p></code></div>
</div>
</li>
<li><strong>Check Permissions:</strong> Ensure that the user has the required permissions to perform the dump operation.</li>
</ul>
<p>If you encounter issues or errors, they may provide more specific details on what needs to be addressed, such as permissions, disk space, or specific database settings.</p>
<p>The post <a href="https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/">Export Large Database in cPanel by SSH Command</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/export-large-database-in-cpanel-by-ssh-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Import Large Database in cPanel by SSH Command</title>
		<link>https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/</link>
					<comments>https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 18 Sep 2024 05:43:58 +0000</pubDate>
				<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1170</guid>

					<description><![CDATA[<p>Importing large database from phpmyadmin Import is difficult because of time limit and file size, so here we will see how to import large databases in phpmyadmin or cPanel using SSH. You can use the &#8216;Terminal&#8217; Option from Cpanel or PuTTY for command. Here we will use &#8216;Terminal&#8217;. &#160; STEP 1: Go to public_html directory &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/" class="more-link">read more<span class="screen-reader-text"> "Import Large Database in cPanel by SSH Command"</span></a></p>
<p>The post <a href="https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/">Import Large Database in cPanel by SSH Command</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Importing large database from phpmyadmin Import is difficult because of time limit and file size,<br />
so here we will see how to import large databases in phpmyadmin or cPanel using SSH.</p>
<p>You can use the &#8216;Terminal&#8217; Option from Cpanel or PuTTY for command.</p>
<p>Here we will use &#8216;Terminal&#8217;.</p>
<p>&nbsp;</p>
<p><strong>STEP 1:</strong><br />
Go to <strong>public_html</strong> directory<br />
<em>Type in terminal</em></p><pre class="urvanov-syntax-highlighter-plain-tag">cd public_html</pre><p>&nbsp;</p>
<p><strong>STEP 2:</strong><br />
Type</p><pre class="urvanov-syntax-highlighter-plain-tag">mysql -u your_DB_username -p your_db_name &lt; path_of_your_sql_file.sql</pre><p>Press Enter</p>
<p>&nbsp;</p>
<p><strong>STEP 3:</strong><br />
This will ask for password: Type the Database password of your DB</p>
<p>and wait&#8230; your data will imported successfully</p>
<p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/">Import Large Database in cPanel by SSH Command</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/import-large-database-in-cpanel-by-ssh-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>YouTube Channel Video API in PHP</title>
		<link>https://www.codypaste.com/youtube-channel-video-api-in-php/</link>
					<comments>https://www.codypaste.com/youtube-channel-video-api-in-php/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 27 May 2024 07:31:18 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1136</guid>

					<description><![CDATA[<p>How to load/list YouTube channel Videos? Here we will see how we can load YouTube channel video in our website by using JSON. Now we will start this from scratch STEP 1 (Get API Key): We will get &#8216;API Key&#8217; from Google Developer Console, you can find steps here : https://developers.google.com/youtube/v3/getting-started STEP 2 (Get Channel &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/youtube-channel-video-api-in-php/" class="more-link">read more<span class="screen-reader-text"> "YouTube Channel Video API in PHP"</span></a></p>
<p>The post <a href="https://www.codypaste.com/youtube-channel-video-api-in-php/">YouTube Channel Video API in PHP</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>How to load/list YouTube channel Videos?</h1>
<p>Here we will see how we can load YouTube channel video in our website by using JSON.</p>
<h2><strong><span style="font-size: 24pt;">Now we will start this from scratch</span></strong></h2>
<p><span style="font-size: 18pt;"><strong>STEP 1 (Get API Key):</strong></span><br />
We will get &#8216;API Key&#8217; from Google Developer Console, you can find steps here : <span style="text-decoration: underline; color: #33cccc;"><a style="color: #33cccc; text-decoration: underline;" href="https://developers.google.com/youtube/v3/getting-started" target="_blank" rel="noopener">https://developers.google.com/youtube/v3/getting-started</a></span></p>
<p><span style="font-size: 18pt;"><strong>STEP 2 (Get Channel ID):</strong></span><br />
Go to your YouTube Channel and copy your channel URL e.g. <em>https://www.youtube.com/channel/XXXThs2cnzpDD-dT</em><br />
and your channel id is &#8216;<strong><em>XXXThs2cnzpDD-dT</em></strong>&#8216;.</p>
<p><strong><span style="font-size: 18pt;">Now see the complete code below</span></strong></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
    $api_key = 'XXXXXXXXC9eEmCnF4qXXXXX';
    $chanel_id = 'XXXnzpXXXXXXXXXXXc-dT'; // Youtube Channel ID, copy from url of channel 'https://www.youtube.com/channel/XXXnzpXXXXXXXXXXXc-dT'
    $maxResults = '20';
    
    $url    = 'https://www.googleapis.com/youtube/v3/search?key='.$api_key.'&amp;channelId='.$chanel_id.'&amp;part=snippet,id&amp;order=date&amp;maxResults=20';
    
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url); 
       
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 60); 
    $result = curl_exec($ch); 
    if(curl_errno($ch) !== 0) { error_log('cURL error when connecting to ' . $url . ': ' . curl_error($ch)); } 
    curl_close($ch); 
    $videoLists = json_decode($result);
    //echo'&lt;pre&gt;';
    //print_r($videoLists);
    
    $videoList = $videoLists-&gt;items;
?&gt;

&lt;?php
    foreach($videoList as $videoListVal){
        ?&gt;
        &lt;div style="width:20%; float:left;"&gt;
            &lt;?php
                $thumb_url      = $videoListVal-&gt;snippet-&gt;thumbnails-&gt;medium-&gt;url; //mediaum,high,default
                $title          = $videoListVal-&gt;snippet-&gt;title;
                $description    = $videoListVal-&gt;snippet-&gt;description;
                $videoId        = $videoListVal-&gt;id-&gt;videoId;
                $publishTime    = $videoListVal-&gt;snippet-&gt;publishTime;
            ?&gt;
            &lt;iframe width="100%" height="auto" src="https://www.youtube.com/embed/&lt;?php echo $videoId; ?&gt;?si=ICtFe87ElbGLgdvm" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;
        &lt;/div&gt;
        &lt;?php
    }
    //echo'&lt;pre&gt;';
    //print_r($videoList);
?&gt;</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/youtube-channel-video-api-in-php/">YouTube Channel Video API in PHP</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/youtube-channel-video-api-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>YouTube channel video in website</title>
		<link>https://www.codypaste.com/youtube-channel-video-in-website/</link>
					<comments>https://www.codypaste.com/youtube-channel-video-in-website/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 27 May 2024 06:42:11 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1134</guid>

					<description><![CDATA[<p>How to load/list YouTube channel Videos? Here we will see how we can load YouTube channel video in our website by using JSON. There are two steps: Query Channels to get the &#8220;uploads&#8221; Id. eg [crayon-69905ba17dcb0933862502/] Use this &#8220;uploads&#8221; Id to query PlaylistItems to get the list of videos. eg [crayon-69905ba17dcbb211896032/] Now we will start &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/youtube-channel-video-in-website/" class="more-link">read more<span class="screen-reader-text"> "YouTube channel video in website"</span></a></p>
<p>The post <a href="https://www.codypaste.com/youtube-channel-video-in-website/">YouTube channel video in website</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>How to load/list YouTube channel Videos?</h1>
<p>Here we will see how we can load YouTube channel video in our website by using JSON.</p>
<p>There are two steps:</p>
<p>Query Channels to get the &#8220;uploads&#8221; Id. eg</p><pre class="urvanov-syntax-highlighter-plain-tag">https://www.googleapis.com/youtube/v3/channels?id={channel Id}&amp;key={API key}&amp;part=contentDetails</pre><p>Use this &#8220;uploads&#8221; Id to query PlaylistItems to get the list of videos. eg</p><pre class="urvanov-syntax-highlighter-plain-tag">https://www.googleapis.com/youtube/v3/playlistItems?playlistId={"uploads" Id}&amp;key={API key}&amp;part=snippet&amp;maxResults=50</pre><p></p>
<h2><strong><span style="font-size: 24pt;">Now we will start this from scratch</span></strong></h2>
<p><span style="font-size: 18pt;"><strong>STEP 1 (Get API Key):</strong></span><br />
We will get &#8216;API Key&#8217; from Google Developer Console, you can find steps here : <a href="https://developers.google.com/youtube/v3/getting-started" target="_blank" rel="noopener">https://developers.google.com/youtube/v3/getting-started</a></p>
<p><span style="font-size: 18pt;"><strong>STEP 2 (Get Channel ID):</strong></span><br />
Go to your YouTube Channel and copy your channel URL e.g. <em>https://www.youtube.com/channel/XXXXXXXThs2cnXXX-dt</em><br />
and your channel id is &#8216;<strong>XXXXXXXThs2cnXXX-dt</strong>&#8216;.</p>
<p><strong><span style="font-size: 18pt;">STEP 3 :</span></strong><br />
Now replace {channel Id} with your channel id and API Key with your API Key<br />
<em>https://www.googleapis.com/youtube/v3/channels?id=<strong>{channel Id}</strong>&amp;key=<strong>{API key}</strong>&amp;part=contentDetails</em><br />
to<br />
<em>https://www.googleapis.com/youtube/v3/channels?id=<strong>XXXXXXXThs2cnXXX-dt</strong>&amp;key=XXXXXXXXXXXXXXXXXXX&amp;part=contentDetails</em></p>
<p>Here you will get &#8220;uploads&#8221; Id to query Playlist Items e.g.</p><pre class="urvanov-syntax-highlighter-plain-tag">{
  "kind": "youtube#channelListResponse",
  "etag": "XXXXXXXXXXXABiQXX",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#channel",
      "etag": "XXXXXXXXXXYmaRUXXXXXX",
      "id": "XXXXXhs2cnzpqc-rAXXX",
      "contentDetails": {
        "relatedPlaylists": {
          "likes": "",
          "uploads": "XXXXwEk6hThs2cnzXXXX" // this is upload id
        }
      }
    }
  ]
}</pre><p><em><strong>&#8220;uploads&#8221;: &#8220;XXXXwEk6hThs2cnzXXXX&#8221;</strong> </em>is the upload id</p>
<p><span style="font-size: 18pt;"><strong>STEP 4 :</strong></span><br />
Use this &#8220;uploads&#8221; Id to query PlaylistItems to get the list of videos. eg</p><pre class="urvanov-syntax-highlighter-plain-tag">https://www.googleapis.com/youtube/v3/playlistItems?playlistId={"uploads" Id}&amp;key={API key}&amp;part=snippet&amp;maxResults=50</pre><p>&nbsp;</p>
<p>Here you will get Palaylist in json Format.</p>
<p>The post <a href="https://www.codypaste.com/youtube-channel-video-in-website/">YouTube channel video in website</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/youtube-channel-video-in-website/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Instagram Feed on Website PHP</title>
		<link>https://www.codypaste.com/instagram-feed-on-website-php/</link>
					<comments>https://www.codypaste.com/instagram-feed-on-website-php/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Fri, 24 May 2024 12:02:49 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1130</guid>

					<description><![CDATA[<p>Instagram Feed in  PHP STE 1 : Get Instagram Access Token https://docs.oceanwp.org/article/487-how-to-get-instagram-access-token STEP 2 : PHP Code for Website [crayon-69905ba17df27952439991/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/instagram-feed-on-website-php/">Instagram Feed on Website PHP</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Instagram Feed in  PHP</p>
<h3><strong>STE 1 : Get Instagram Access Token</strong></h3>
<p><a href="https://docs.oceanwp.org/article/487-how-to-get-instagram-access-token" target="_blank" rel="noopener">https://docs.oceanwp.org/article/487-how-to-get-instagram-access-token</a></p>
<h3><strong>STEP 2 : PHP Code for Website</strong></h3>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
$access_token = 'IGQVJWR0VIbHF6cGl0aTZA5NnFsMkxhbHY3MmR0em83emNZAQ3Vxa0dtenRrTHZAqVzFpbHhENmtDRjNIY2lFSGthUkFzX191TEU3SDJzcVJDcnNTYkVYVFlRa1JJZAE12YmFLMVdpWUV4YTJ6cGxWeDBmaQZDZD';

$fields ='id,caption,thumbnail_url,media_url,permalink';

  function fetchData($url){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  $result = curl_exec($ch);
  curl_close($ch); 
  return $result;
  }

  $result = fetchData("https://graph.instagram.com/me/media?fields=".$fields."&amp;access_token=".$access_token."");


  $result = json_decode($result);
  
  //echo'&lt;pre&gt;';
  //print_r($result); die();
  
  
  foreach ($result-&gt;data as $post) {
      
      $thumbnail_url    = $post-&gt;thumbnail_url;
      $image    = $post-&gt;media_url;
      $url      = $post-&gt;permalink;
      $caption  = $post-&gt;caption; // Text content
     ?&gt;
        &lt;div style="width:20%; float:left; padding:5px; margin:5px; border:solid 1px #ebebeb;"&gt;
            &lt;a href="&lt;?php echo $url; ?&gt;" target="_blank"&gt;
                &lt;?php
                    if($thumbnail_url==""){
                ?&gt;
                    &lt;img src="&lt;?php echo $image; ?&gt;" width="100%"&gt;
                &lt;?php }else{
                    ?&gt;
                    &lt;img src="&lt;?php echo $thumbnail_url; ?&gt;" width="100%"&gt;
                    &lt;?php
                } ?&gt;
                
                
                
                
                
                &lt;p&gt;&lt;?php echo $caption; ?&gt;&lt;/p&gt;
            &lt;/a&gt;
        &lt;/div&gt;
     &lt;?php
  }
?&gt;</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/instagram-feed-on-website-php/">Instagram Feed on Website PHP</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/instagram-feed-on-website-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Product Cost by Sell Price and GST</title>
		<link>https://www.codypaste.com/product-cost-by-sell-price-and-gst/</link>
					<comments>https://www.codypaste.com/product-cost-by-sell-price-and-gst/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 15 Apr 2024 10:12:31 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1116</guid>

					<description><![CDATA[<p>X + (X*5/100) = 500; Find X (product cost) [crayon-69905ba17e30c671124732/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/product-cost-by-sell-price-and-gst/">Product Cost by Sell Price and GST</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>X + (X*5/100) = 500;</p>
<p>Find X (product cost)</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
    $sale_price = 500;
    $gst        = 5; //percent
    $x          = 1; //ye by default 1 hi rahega
    $y          = 100/$gst; 
    $z          = $y*$sale_price;
    $v          = $y+$x;
    echo $product_cost = $z/$v;
?&gt;</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/product-cost-by-sell-price-and-gst/">Product Cost by Sell Price and GST</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/product-cost-by-sell-price-and-gst/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Make Google reCaptcha required and use in JQuery Ajax</title>
		<link>https://www.codypaste.com/google-recaptcha-required-and-use-in-jquery-ajax/</link>
					<comments>https://www.codypaste.com/google-recaptcha-required-and-use-in-jquery-ajax/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Thu, 18 Jan 2024 06:56:50 +0000</pubDate>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[CodeIgniter 4]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=1088</guid>

					<description><![CDATA[<p>Add reCaptcha in HTML form [crayon-69905ba17e58f126449955/] &#160; Get reCaptcha Value in jQuery and pass in ajax [crayon-69905ba17e598766208535/] &#160; Validate reCaptcha [crayon-69905ba17e59c433672639/] &#160; Make reCaptcha checkbox required [crayon-69905ba17e59f101844220/] &#160; Reset reCaptcha For reCaptcha v2, use: [crayon-69905ba17e5a2117563256/] If you&#8217;re using reCaptcha v1 (probably not): [crayon-69905ba17e5a5707639031/]</p>
<p>The post <a href="https://www.codypaste.com/google-recaptcha-required-and-use-in-jquery-ajax/">Make Google reCaptcha required and use in JQuery Ajax</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-size: 14pt;"><strong>Add reCaptcha in HTML form</strong></span></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;
            &lt;div class="g-recaptcha" data-sitekey="YOUR-SITE-KEY"&gt;&lt;/div&gt;</pre><p>&nbsp;</p>
<p><span style="font-size: 14pt;"><strong>Get reCaptcha Value in jQuery and pass in ajax</strong></span></p><pre class="urvanov-syntax-highlighter-plain-tag">var g_recaptcha_response = grecaptcha.getResponse();
var dataString = 'uname='+ uname + '&amp; g-recaptcha-response=' + g_recaptcha_response;</pre><p>&nbsp;</p>
<p><span style="font-size: 14pt;"><strong>Validate reCaptcha</strong></span></p><pre class="urvanov-syntax-highlighter-plain-tag">$secret = 'YOUR-SECRET-KEY'; //google captcha check
//get verify response data
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&amp;response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if($responseData-&gt;success){
   //Do if captcha is valid
}</pre><p>&nbsp;</p>
<p><span style="font-size: 14pt;"><strong>Make reCaptcha checkbox required</strong></span></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;!-- GCaptcha require karne ke liye--&gt;
    &lt;style&gt;
        #g-recaptcha-response {
          display: block !important;
          position: absolute;
          margin: -78px 0 0 0 !important;
          width: 302px !important;
          height: 76px !important;
          z-index: -999999;
          opacity: 0;
        }
    &lt;/style&gt;
    &lt;script&gt;
        window.addEventListener('load', () =&gt; {
      const $recaptcha = document.querySelector('#g-recaptcha-response');
      if ($recaptcha) {
        $recaptcha.setAttribute('required', 'required');
      }
    })
    &lt;/script&gt;
&lt;!-- --&gt;</pre><p>&nbsp;</p>
<p><strong><span style="font-size: 14pt;">Reset reCaptcha</span></strong></p>
<p>For reCaptcha v2, use:</p><pre class="urvanov-syntax-highlighter-plain-tag">grecaptcha.&lt;span class=&quot;hljs-title function_&quot;&gt;reset&lt;/span&gt;();</pre><p>If you&#8217;re using reCaptcha v1 (<strong>probably not</strong>):</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;span class=&quot;hljs-title class_&quot;&gt;Recaptcha&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;reload&lt;/span&gt;();</pre><p></p>
<p>The post <a href="https://www.codypaste.com/google-recaptcha-required-and-use-in-jquery-ajax/">Make Google reCaptcha required and use in JQuery Ajax</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/google-recaptcha-required-and-use-in-jquery-ajax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
