$path = "http://www.abc.com"; $user_agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"; $in_curl = curl_init(); curl_setopt($in_curl, CURLOPT_URL, $path); curl_setopt($in_curl, CURLOPT_POST, 0); curl_setopt($in_curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($in_curl, CURLOPT_HEADER, false); curl_setopt($in_curl, CURLOPT_USERAGENT,$user_agent); curl_setopt($in_curl, CURLOPT_CONNECTTIMEOUT , 30); curl_setopt($in_curl, CURLOPT_TIMEOUT, 5); curl_setopt($in_curl, CURLOPT_SSL_VERIFYPEER, false);# required for https urls $resultxml = curl_exec($in_curl); $status = curl_getinfo($in_curl); curl_close($session); if (file_put_contents ('./responsedata.xml', $resultxml) !== false) { echo 'Success!'; } else { echo 'Failed'; }
Thursday 22 November 2018
How to save responose of cURL to XML file
Friday 23 March 2018
Send Push Notification to Users Using Firebase Messaging Service in PHP
Chrome: 50+
Firefox: 44+
Opera Mobile: 37+
Wednesday 13 September 2017
How to get closest date compared to an array of dates in PHP
Let's say I have an array as follows:
Array ( [0] => 2017-09-14 [1] => 2017-09-15 [2] => 2017-09-16 [3] => 2017-09-17 [4] => 2017-09-18 [5] => 2017-09-19 )
Thursday 24 August 2017
File Size MB/KB/GB Conversion
<?php function fileSizeConversion($bytes) { if ($bytes >= 1073741824) { $bytes = number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { $bytes = number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { $bytes = number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes == 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; } ?>
Monday 2 May 2016
Facebook Messenger Bot Api Using Curl PHP
How to integrate Facebook Messenger Bot api with Curl and php You can find My article @PHPGANG Facebook Messenger API for Pages Using Curl PHP
Thursday 10 September 2015
Get profile picture from facebook, twitter and gravatar
Get profile picture from facebook
http://graph.facebook.com/<ID>/picture?type=<small|normal|album|large|square>Eg: http://graph.facebook.com/100002342793491/picture?type=large
Monday 24 August 2015
Detecting Browser Geolocation Info
if("geolocation" in navigator) { }else { alert("No soup for you! Your browser does not support this feature"); }
Subscribe to:
Posts (Atom)