Class 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
$fetch_data = new cURL_fetch_web_data(array(CURLOPT_SSL_VERIFYPEER => 1), 5);
Make the call
$fetch_data->get_url_data('https://www.simplemachines.org'); // fetch a page
$fetch_data->get_url_data('https://www.simplemachines.org', array('user' => 'name', 'password' => 'password')); // post to a page
$fetch_data->get_url_data('https://www.simplemachines.org', parameter1¶meter2¶meter3); // 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
Copyright: 2020 Simple Machines and individual contributors
License: BSD
Author: Simple Machines https://www.simplemachines.org
Located at Sources/Class-CurlFetchWeb.php
public
|
#
__construct( array $options = array(), integer $max_redirect = 3 )
Start the curl object - allow for user override values |
public
object
|
#
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
string
|
|
public
array|string
|
#
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. |
public
integer
|
$max_redirect
Maximum number of redirects |
|
public
array
|
$user_options
An array of cURL options |
#
array()
|
public
string
|
$post_data
Any post data as form name => value |
|
public
array
|
$options
An array of cURL options |
|
public
integer
|
$current_redirect
??? |
|
public
array
|
$response
Stores responses (url, code, error, headers, body) in the response array |
#
array()
|
public
string
|
$headers
The header |