Skip to content

Instantly share code, notes, and snippets.

View sohelrana820's full-sized avatar
💭
I may be slow to respond.

Sohel Rana sohelrana820

💭
I may be slow to respond.
View GitHub Profile
@sohelrana820
sohelrana820 / parsing_xml_with_multiple_namespaces.php
Last active April 30, 2022 07:30
Parsing XML with multiple namespaces using PHP
<?php
/**
* @author: Sohel Rana
* @url: https://blog.sohelrana.me/parsing-xml-multiple-namespaces-using-php/
* @license: MIT
* Parsing XML with multiple namespaces using PHP
*/
$xmlString = "<en:Envelope xmlns:en=\"http://www.softcare.com/HIPAA/SC/Enrollment/0301\"
xmlns:sc=\"http://www.softcare.com/HIPAA/SC/0203\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
@sohelrana820
sohelrana820 / is_domain_contain.php
Created March 12, 2021 14:29
Check text string contain domain ot not.
<?php
/**
* This function will check the text and find the domain name from test.
* If any domain found then it will validate domain name. If domain valid
* then return true otherwise return false.
*
* @param $textString
* @return bool
*/
@sohelrana820
sohelrana820 / GoogleVisionApi.php
Created December 27, 2020 21:01
Using Google Visio API
<?php
namespace app\Components;
use Vision\Annotation\SafeSearchAnnotation;
use Vision\Request\Image\Base64Image;
use Vision\Vision;
/**
@sohelrana820
sohelrana820 / index.php
Created October 18, 2015 07:51
php crowler for prothom alo
<?php
function getLinks($websiteURL)
{
$result = array();
$dom = new domDocument;
@$dom->loadHTML(file_get_contents($websiteURL));
$dom->preserveWhiteSpace = false;
$links = $dom->getElementsByTagName('a');
foreach ($links as $tag) {
@sohelrana820
sohelrana820 / default.conf
Last active March 6, 2020 06:49
Create NGINX Virtual Host with PHP 7.0
server {
listen 80;
server_name app.example.dev; # Write your server name
root /var/www/PROJECT/PROJECT_ROOT/; # Write your project root here.
access_log /var/log/nginx/PROJECT_ACCESS.log;
error_log /var/log/nginx/PROJECT_ERROR.log;
location / {
index index.php;
@sohelrana820
sohelrana820 / recursively_delete_directory_and_its_files.php
Last active March 6, 2020 06:48
How to Recursively Delete a Directory and its Entire Contents Using PHP
<?php
/**
* @author: Sohel Rana <sohelrana820>
* @author URL: https://blog.sohelrana.me/
* @link: https://blog.sohelrana.me/recursively-delete-directory-entire-contents-using-php/
* @licence: MIT
*
* @param $directory
* @return bool
*/
@sohelrana820
sohelrana820 / cpanel.php
Created May 13, 2017 12:38
Upload File Using cPanel API
<?php
/**
* This is tiny class wrapper for uploading files using Cpanel API
*
* @author: Sohel Rana <me.sohelrana@gmail.com>
* @url: https://blog.sohelrana.me/upload-file-using-cpanel-api/
* @license: MIT
*/
@sohelrana820
sohelrana820 / array-chunk-based-key.php
Last active September 17, 2018 14:57
Array Chunk based on Key PHP
<?php
/**
* @author: Sohel Rana <me.sohelrana@gmail.com>
* @author URL: http://sohelrana.me
* @licence: MIT
* @link: https://blog.sohelrana.me/array-chunk-based-on-key-value-in-php/
*
* This function is for divide/group/chunk an multidimensional array based on same key.
*/
@sohelrana820
sohelrana820 / XMLRPCClient.php
Created September 17, 2018 10:55
XML RPC Client Example
<?php
/**
* Class XMLRPCClient
*/
class XMLRPCClient
{
/**
* @var
*/
@sohelrana820
sohelrana820 / xero-html-template-navbar.html
Created September 9, 2018 18:09
Fixed Navbar of XERO HTML Template
<header class="main-header sticky-header" id="main-header-2">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="navbar navbar-expand-lg navbar-light rounded">
<a class="navbar-brand logo mr-auto" href="index.html">
<img src="assets/img/logos/black-logo.png" alt="logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="fa fa-bars"></span>