pero me da este error: Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/unlim219/public_html/a/curl.php on line 93
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/unlim219/public_html/a/curl.php on line 93
Código PHP:
Ver original
<?php /******************************************************************************* * CURL Class ******************************************************************************* * Author: Vikas Patial * Email: [email protected] * Website: http://www.ngcoders.com * * File: curl.php * Version: 1.0.0 * Copyright: (c) 2008 - Vikas Patial * You are free to use, distribute, and modify this software * under the terms of the GNU General Public License. See the * included license.txt file. * ******************************************************************************* * VERION HISTORY: * * v1.1.0 [1.1.2010] - Streaming and getSize Added * v1.0.0 [18.9.2008] - Initial Version * ******************************************************************************* * DESCRIPTION: * * NOTE: See www.ngcoders.com for the most recent version of this script * and its usage. * ******************************************************************************* */ class Curl { var $callback = false; var $secure = false; var $conn = false; var $cookiefile =false; var $header = false; var $cookie = false; var $follow = true; var $dump = false; var $range = false; var $timeout = false; var $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; function Curl($u = false) { if (!$u) { } $this->cookiefile= $file; } function setCallback($func_name) { $this->callback = $func_name; } function close() { //unlink($this->cookiefile); } } function doRequest($method, $url, $vars) { $ch = $this->conn; } else { } curl_setopt( $ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".$_SERVER['REMOTE_ADDR'], "HTTP_X_FORWARDED_FOR: ".$_SERVER['REMOTE_ADDR'])); // send users ip ??? if($this->secure) { } if ($this->cookie) { } if ($this->follow) { } else { } if($this->dump) { } else { } { } if($this->timeout) { } else { } if ($method == 'POST') { } if ($data) { if ($this->callback) { $callback = $this->callback; $this->callback = false; } else { return $data; } } else { return false; } } function get($url) { return $this->doRequest('GET', $url, 'NULL'); } function processHeader($ch,$string) { { $this->size = $match[1]; return false; } { $this->size = $match[1]; return false; } } function getSize($url) { $this->size = false; $this->dump = true; // some sites dont echo in curl $this->doRequest('GET', $url,false); $this->dump = false; return $this->size; } function getError() { } function post($url, $params = false) { $post_data = ''; foreach($params as $var=>$val) { } } else { $post_data = $params; } return $this->doRequest('POST', $url, $post_data); } function streamHeader($ch,$string) { } function stream($url) { $this->dump = true; $this->doRequest('GET', $url,false); } function getRedirect($url) { $this->follow = false; $html = $this->get($url); if(preg_match('/Location: (.*?)[\r\n]+/',$html,$match) || preg_match('/http-equiv=\'Refresh\' content=\'[0-9]+;url=(.*?)\'/s',$html,$match)) { return $match[1]; } $this->follow = true; } } function getPage($url,$post = false,$cookie = false) { $curl = new Curl($pURL['host']); { $curl->secure = true; } if ($post) { return $curl->post($url,$post); } else { return $curl->get($url); } }