mardi 24 novembre 2015

integrating mailchimp with laravel resulting an error

I am trying to make use of this package in order to push all the subscribed email to the mail chimp subscriber list. I have followed the instructions as provided but every time i try to subscribe an email, its giving me an error called

 ServiceRefusedSubscription in NewsletterList.php line 48:
API call to lists/subscribe failed: SSL certificate problem: unable to get local issuer certificate

I have set the MAILCHIMP_API_KEY and LIST_ID in my .env file and here is my controller where I am trying to achieve the result

public function postSubscribe(Request $request)
    {
       $v = validator::make($request->all(), [
           'email' => 'required|email|unique:subscriber'
       ]);

        if ($v->fails()){
            return redirect::back()
                ->withErrors($v->messages());
        } else {
               \Newsletter::subscribe(Input::get('email'));
                $sub = new Subscriber;
                $sub->email         = Input::get('email');
                $sub->subscribed    = 1;
                $sub->save();

            return redirect::back()
                ->with('messsage', 'Subscribed successfully');
        }
    }

Now I want this entered email to save in the list that I have created in mailchimp but I am getting the error that was mentioned above. What I am doing wrong? If anyone can help me please :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire