curl_fetch_web_data

Class curl_fetch_web_data Simple cURL class to fetch a web page Properly redirects even with safe mode and basedir restrictions Can provide simple post options to a page Load class Initiate as - $fetch_data = new cURL_fetch_web_data(); - optionally pass an array of cURL options and redirect count - cURL_fetch_web_data(cURL options array, Max redirects); - $fetch_data = new cURL_fetch_web_data(array(CURLOPT_SSL_VERIFYPEER => 1), 5); Make the call - $fetch_data('https://www.simplemachines.org'); // fetch a page - $fetch_data('https://www.simplemachines.org', array('user' => 'name', 'password' => 'password')); // post to a page - $fetch_data('https://www.simplemachines.org', parameter1&parameter2&parameter3); // post to a page Get the data - $fetch_data->result('body'); // just the page content - $fetch_data->result(); // an array of results, body, header, http result codes - $fetch_data->result_raw(); // show all results of all calls (in the event of a redirect) - $fetch_data->result_raw(0); // show all results of call x
Methods Summary
public
# __construct( array $options = array ( ), int $max_redirect = 3 )
Start the curl object - allow for user override values
public
# get_url_data( string $url , array $post_data = array ( ) )
Main calling function, - will request the page data from a given $url - optionally will post data to the page form if post data is supplied - passed arrays will be converted to a post string joined with &'s - calls set_options to set the curl opts array values based on the defaults and user input
public
# result( string $area = '' )
Used to return the results to the calling program - called as ->result() will return the full final array - called as ->result('body') to just return the page source of the result
public
# result_raw( string $response_number = '' )
Will return all results from all loops (redirects) - Can be called as ->result_raw(x) where x is a specific loop results. - Call as ->result_raw() for everything.
Properties Summary
public int $max_redirect
# NULL
public array $user_options
# array ( )
public string $post_data
# NULL
public array $options
# NULL
public int $current_redirect
# NULL
public array $response
# array ( )
public string $headers
# NULL