Backup of MySQL database with a PHP script
Sometimes you need to make a mysqldump backup without having SSH access or PHPMyAdmin. It can be done with PHP by means of SHOW TABLES/SHOW CREATE TABLE mysql queries. Below is an improved solution proposed here.
Improvements:
- Got rid of memory_limit – writing to file on every iteration
- gzip support – you don’t have to download huge uncompressed .sql
- PHP notice fixed
- added IF EXISTS to DROP TABLE
- ereg_replase -> str_replace
- added set_time_limit(0) to work with large DB’s
In order to make a dump:
USPS Web Tools guide
Besides its primary role – delivering mail, USPS allows several other functions by means of http://www.usps.com/webtools/. In order to use them you’ll need to make xml in conformance with USPS Web Tools documentation and send it as for example cURL request. Below given is a class that will handle all these cURL requests. It’s the class serving all the requests in this article. We’ll need to pass it only URL, API method name and the XML.
//connect to USPS
class USPS {
public function connectToUSPS($url, $api, $xml) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $api . $xml);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$error = curl_error($ch);
if (empty($error)) {
return $result;
} else {
return false;
}
}
}
How to bypass IP validation with cURL script
Hi All,
all we know the Tor network for anonymous surfing. In case you’ve never header about it – welcome to http://en.wikipedia.org/wiki/Tor_%28ano … network%29
So, can we use it in a php cURL script to bypass IP validation, country or even your own provider IP ban? Yes, we can. And here is the tutorial.