Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/fritzbox_api_php/fritzbox_api.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public function __destruct()
public function doPostForm($formfields = array())
{
$ch = curl_init();

//curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if ( isset($formfields['getpage']) && strpos($formfields['getpage'], '.lua') > 0 )
{
curl_setopt($ch, CURLOPT_URL, $this->config->getItem('fritzbox_url') . $formfields['getpage'] . '?sid=' . $this->sid);
Expand Down Expand Up @@ -156,8 +158,8 @@ public function doPostForm($formfields = array())
}

// set SSL-options and path to certificate
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CAPATH, '/etc/ssl/certs');

// support for pre FRITZ!OS 5.50 remote config
Expand Down Expand Up @@ -189,7 +191,9 @@ public function doPostFile($formfields = array(), $filefileds = array())
// enable for debugging:
//curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

// if filefileds not specified ('@/path/to/file.xml;type=text/xml' works fine)
if(empty( $filefileds )) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $formfields); // http_build_query
Expand Down Expand Up @@ -300,6 +304,7 @@ public function doGetRequest($params = array())
curl_setopt($ch, CURLOPT_URL, $this->config->getItem('fritzbox_url') . $getpage . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
//curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
if ( $this->config->getItem('enable_remote_config') )
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Expand Down Expand Up @@ -338,7 +343,7 @@ protected function initSID()

// read the current status
$session_status_simplexml = simplexml_load_string($this->doGetRequest(array('getpage' => $loginpage)));

if ( !is_object($session_status_simplexml) || get_class($session_status_simplexml) != 'SimpleXMLElement' )
{
$this->error('Response of initialization call ' . $loginpage . ' in ' . __FUNCTION__ . ' was not xml-formatted.');
Expand Down