| | |
CURL PHP Ready function !
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
This is CURL Ready function , to use it just call do post if the page you are calling has post variables , or get if it has get variables
$random=rand(1, 100000); $cookie=$random . ".txt"; $agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; function doRequest($method, $url, $referer, $agent, $cookie, $vars) { $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url); if($referer != "") { curl_setopt($ch, CURLOPT_REFERER, $referer); } curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); if ($method == 'POST') { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); } if (substr($url, 0, 5) == "https") { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); } $data = curl_exec($ch); curl_close($ch); if ($data) { return $data; } else { return curl_error($ch); } } function get($url, $referer, $agent, $cookie) { return doRequest('GET', $url, $referer, $agent, $cookie, 'NULL'); } function post($url, $referer, $agent, $cookie, $vars) { return doRequest('POST', $url, $referer, $agent, $cookie, $vars); }
Similar Threads
- login at youtube using cURL and php ? (PHP)
- How to embed youtube player in php mail function (PHP)
- PHP Mail() Function (PHP)
- creating cookies using curl-php (PHP)
- PHP mail function issue (PHP)
- Need urgent assistance with php date function and recoring it into MySQL (PHP)
- php date function (PHP)
- Sending HTML email via PHP mail function (PHP)
- my php session_destroy() function not working (PHP)
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error file files folder form forms function functions google howtowriteathesis href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop parse paypal pdf php problem provider query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update updates upload url validation validator variable video web xml youtube



