Google+ Api not updating - ssl

I am having an issue with my Google+ Api. It was working fine, but suddenly stopped retrieving data from Google+ page.
This is the code, which was working fine and nothing is changed in it.
<?php
$guserid = get_field('google_plus_user_id','option');
$gplus_api = get_field('google_plus_api_key','option');
if(empty($guserid))
$guserid = "***ID***";
if(empty($gplus_api))
$gplus_api = "***API***";
$gactivity_url = "https://www.googleapis.com/plus/v1/people/".$guserid."/activities/public?maxResults=1&key=".$gplus_api;
$gactivity = json_decode(file_get_contents($gactivity_url));
$items = $gactivity->items[0];
$created_time = $items->updated;
$link = $items->url;
$title = $items->title;
$attachments = $items->object->attachments[0];
$full_picture = $attachments->image->url;
?>
<img src="<?php echo $full_picture; ?>" alt="Google+"/>
<div class="gp_content">
<div><?php echo $attachments->content ?></div>
<a target="_blank" href="<?php echo $link; ?>"><?php echo $title; ?> </a>
<dt> <?php echo date('d/m/Y', strtotime($created_time)); ?> </dt>
I am receiving the following errors
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Warning: file_get_contents(): Failed to enable crypto in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Warning: file_get_contents(https://www.googleapis.com/plus/v1/people/USERID/activities/public?maxResults=1&key=APIKEY): failed to open stream: operation failed in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 115
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 117
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 118
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 119
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 121
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 121
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 122
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 122
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 126
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 126
Any help is appreciated.

This should do it:
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
]
]);
$data = file_get_contents($gactivity_url, false, $context);

Related

File upload system in laravel 5.1

I am trying to upload files using laravel5.1.But i am facing error like
FatalErrorException in Handler.php line 25:
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in E:\xampp\htdocs\mp-admin\vendor\compiled.php on line 1720 and defined in E:\xampp\htdocs\mp-admin\app\Exceptions\Handler.php:25
Stack trace:
#0 E:\xampp\htdocs\mp-admin\vendor\compiled.php(1720): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown
Here is my view
<div class="form-group">
<label >Logo</label>
<input type="file" name="image" >
</div>
Controller:
$entry = new companyprofiles();
$file = Input::get('image');
$extension = $file->getClientOriginalExtension();
Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file));
$entry->mime = $file->getClientMimeType();
$entry->original_filename = $file->getClientOriginalName();
$entry->filename = $file->getFilename().'.'.$extension;
$entry->save();
But first when i was trying it was storing in database and folder as well.after that continuously giving the same above error.
Please help me with this.if i do dd the value also its giving me the same error i could not able to find where is the error.Not getting stored in database.
Remove or delete vendor/compile.php
Run composer dump-autoload
if not work then
run composer update

Undefined Variable in template-contact.php on line 92

I have a wordpress website, and I am getting an error message above the form on my contact page.
Error message reads:
Notice: Undefined variable: success in /home/crea6303/public_html/westafricanplumbing.com/wp-content/themes/waseps-custom/template-contact.php on line 92
template-contact.php code is:
<?php if($success) {
echo "
<div class=\"info-message\" style=\"background-color: #75a226;\">
<i class=\"fa fa-times\"></i>
<p><strong>".__('Success:', DAT_NAME)."</strong>".__('The Message has been sent', DAT_NAME)."</p>
</div>";
} ?>
I don't have a clue how to fix this...can anyone help?
Thank you kindly
Ferg

Fatal error on Mink WebAssert.textPageContains when assertion fails

I'm using Behat\Mink\Driver\Selenium2Driver. This is the #Then function for one of my features:
/**
* #Then /^I should see "([^"]*)"$/
*/
public function iShouldSee($result)
{
$verification = new WebAssert($this->session);
try
{
$verification->pageTextContains($result);
}
catch(ResponseTextException $e)
{
printf("something went wrong");
}
}
If I write a scenario where the assertion should pass, I have no problem: it runs properly and creates the output file in junit format that I will pass to Jenkins later.
But if I change the scenario so it should fail, the execution is interrupted after the failed assertion text and I get this message:
Then I should see "my text" # MyCompany\MyBDDBundle\Features\Context\FeatureContext::iShouldSee()
The text "my text" was not found anywhere in the text of the current page.
PHP Fatal error: Call to a member function text() on a non-object in C:\BitNami\wampstack-5.4.15-0\frameworks\symfony\vendor\behat\mink-selenium2-driver\src\Behat\Mink\Driver\Selenium2Driver.php on line 464
Fatal error: Call to a member function text() on a non-object in C:\BitNami\wampstack-5.4.15-0\frameworks\symfony\vendor\behat\mink-selenium2-driver\src\Behat\Mink\Driver\Selenium2Driver.php on line 464
I've been looking the Selenium2Driver.php file and line 464 is inside function getText($xpath) that I just don't use.
And finally, having the test been interrupted, the junit file that is created as an output only contains the XML header, although there were many passed scenarios.
<?xml version="1.0" encoding="UTF-8"?>
Why is the test working when the assertion passes but it crashes when it fails?

Bigcommerce Class 'Bigcommerce\Api\Error' not found

I keep getting this error when I try to execute a simple script on the server while it runs fine on my local machine.
Error
Fatal error: Class 'Bigcommerce\Api\Error' not found in
/customers/0/4/1/myDomainName/httpd.www/demo/hello/bigcommerce.php on
line 370
link to API
Sample Code
require_once 'bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array(
'store_url' => 'https://www.mystore.com/',
'username' => 'myUsername',
'api_key' => 'myPass'
));
Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);
?>
Php Version
Server: 5.3.23
Local: 5.3.13
I fixed it by moving the declaration of class Error to just above the line 370 where class ClientError was declared.

Fatal error: Uncaught exception 'Zend_Cache_Exception' with message > 'cache_dir must be a directory'

After doing my code update. I got this error.
Could you help me figure this one out?
I gave 777 permission to all of the folders.
Thanks in advance!
Fatal error: Uncaught exception 'Zend_Cache_Exception' with message
'cache_dir must be a directory' in
C:\xampp\htdocs\mts\library\Zend\Cache.php:208 Stack trace: #0
C:\xampp\htdocs\mts\library\Zend\Cache\Backend\File.php(154):
Zend_Cache::throwException('cache_dir must ...') #1
C:\xampp\htdocs\mts\library\Zend\Cache\Backend\File.php(121):
Zend_Cache_Backend_File->setCacheDir('C:\xampp\htdocs...') #2
C:\xampp\htdocs\mts\library\Zend\Cache.php(152):
Zend_Cache_Backend_File->__construct(Array) #3
C:\xampp\htdocs\mts\library\Zend\Cache.php(93):
Zend_Cache::_makeBackend('File', Array, false, false) #4
C:\xampp\htdocs\mts\application\Bootstrap.php(22):
Zend_Cache::factory('Core', 'File', Array, Array) #5
C:\xampp\htdocs\mts\library\Zend\Application\Bootstrap\BootstrapAbstract.php(636):
Bootstrap->_initCache() #6
C:\xampp\htdocs\mts\library\Zend\Application\Bootstrap\BootstrapAbstract.php(589):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('cache') 7#
C:\xampp\htdocs\mts\library\Zend\Application\Bootstrap\Boots in
C:\xampp\htdocs\mts\library\Zend\Cache.php on line 208
Setting the cache in bootstrap
protected function _initCaching() {
$frontend = array(
'lifetime' => 7200,
'automatic_serialization' => true
);
$backend = array(
'cache_dir' => sys_get_temp_dir(), /**automatically detects**/
);
$cache = Zend_Cache::factory('core', 'File', $frontend, $backend);
Zend_Registry::set('cache', $cache);
}
Go to C:\xampp\htdocs\mts\library\Zend\Cache\Backend\File.php at line 154 and echo $value before the conditions. It should give you a directory address. Make sure that directory exists in your file system. Basically you need to set this path correctly in your zend configuration.
It's not about permission, ZF can't find the cache directory. Check if the directory you set in application.ini actually exists.
As you are on Windows machine, permissions shouldn't be a problem.