View Single Post
  #5  
Old 04-01-2017, 02:34 AM
 
ajeetsingh ajeetsingh is offline
 

Member
  
Join Date: Dec 2016
Posts: 28
 

Default Re: Issue in Curl calling in xcart page

Hello ,

I am not getting a wright solution for my problem. Again i am explaining my problem below:

I just want to call a notification message in a xcart backend page on clicking a button on that page for Mozila FireFox browser, And for that purpose i am using the curl request and the code for which i am using for the function is as below.

PHP Code:
public function sendPushMozila($sub_ids){
        
$url 'https://updates.push.services.mozilla.com/wpush/v1/';
        
$headers = array(
          
'Content-Type: application/json',
          
'TTL: 600000'
        
);
        foreach (
$sub_ids as $key => $value) {
            
$final_url=$url.$value;
            
$ch curl_init();  
            
// Set the url, number of POST vars, POST data
            
curl_setopt($chCURLOPT_URL$final_url);
            
curl_setopt($chCURLOPT_POSTtrue);
            
curl_setopt($chCURLOPT_HTTPHEADER$headers);
            
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);

            
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
            
/*curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));*/
            
$result curl_exec($ch);
            
//var_dump($result); die;
            
curl_close($ch);
        }
    } 

In the above code the $sub_ids is the subscription ids of more then one user.

So please help me.

Thanks in Advance.
__________________
Ajeet Singh
Sr.Software Developer
Webkul Software Pvt. Ltd.
Reply With Quote