/ Published in: PHP
Helpful for remembering useful CURLOPT constants. Taken from an example in the php manual comments.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function get_web_page( $url,$curl_data ) { CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => 1, // i am sending post data CURLOPT_POSTFIELDS => $curl_data, // this are my post vars CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_VERBOSE => 1 // ); // $header['errno'] = $err; // $header['errmsg'] = $errmsg; // $header['content'] = $content; return $header; } $curl_data = "var1=60&var2=test"; $url = "https://www.example.com"; $response = get_web_page($url,$curl_data); print '<pre>'; ?>
URL: http://www.php.net/manual/en/function.curl-setopt-array.php