Push Wizard App not found error - php

I need to implement Pushwizard in PHP to send push notification.
I have implemented this php code
$api_key = "MY_API_KEY";
$msg = "Website PHP msg.";
$data = array("command" => "send", "message" => $msg);
$data_string = json_encode($data);
$ch = curl_init('https://pushwizard.com/api/'.$api_key.'/json');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array ( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
$result = curl_exec($ch);
print $result;
But it gives me this error message.
{"error":"0002","error_msg":"app not found"}
I have check my configuration. From pushWizard admin panel I can able to send push notification, It works fine there. But from PHP api it is giving me an error.
I have googled it but not able to find any answer.
Does any own implemented it??
Thanks in advance.

You are probably trying to use the API with the App Key instead of the API Key.

Related

INVALID_TICKET in Zoho mail php Integration

I am using zoho email for sending email.
but when Trying the following code to send email ,
it returns the error invalid_ticket.
$data = array(
"fromAddress"=> "from#gmail.com",
"toAddress"=> "receive#gmail.com",
"subject"=> "Email - Always and Forever",
"content"=> "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication.",
"askReceipt" => "yes"
);
// Convert the PHP array into a JSON format
$payload = json_encode($data);
// Initialise new cURL session
$ch = curl_init('https://mail.zoho.in/api/accounts/<user_id>/messages');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
print_r($result);
curl_close($ch);
?>
Please help me to solve this. Thanks
This is not the right forum for this question but according to official documentation, you need to Kindly regenerate the authtoken with that generated authtoken which will work fine.
Source: https://help.zoho.com/portal/en/community/topic/zoho-cretor-getting-error-message-invalid-ticket-id-code-4834-when-trying-to-insert-records-in-zoho-crm

discord php curl login Fail

i want to login into discord with php curl but did't work's for me what is the problem in my code i want auto-login into discord and grab data from html ....!
cloed
There are some advices:
1) If you want to see some responsed information. You have to echo $answer. Otherwise you couldn't see the response even the data were sent correctly.
2) The site used captcha. I tried it with correct email/password and get the following response {"captcha_key": ["captcha-required"]} . I have no idea how to round this. Maybe you should contact the Discord.
3) The site requires json data. Here are the codes I used:
<?php
$data = array("email" => "XXXX", "password" => "XXXX");
$data_string = json_encode($data);
$ch = curl_init('https://discordapp.com/api/v6/auth/login');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$answer = curl_exec($ch);
echo $answer;
if (curl_error($ch)) {
echo curl_error($ch);
}
?>
Hope this will help.

How to send Chrome push notification to mulitple device

I want to send chrome push notifications to the registered user.I followed this link https://developers.google.com/web/fundamentals/getting-started/push-notifications/?hl=en to develop a basic push notification and it works fine.
For now, I am sending notification to users by running curl script with subscription id in the terminal. Using this I can send notification to a single user. I want to send to multiple users. How can I achieve this?
Try this :-
<?php
$data = ["registration_ids" => ["regid1","regid2",...,"regidn"]];
$dataString = json_encode($data);
$curl = curl_init('https://android.googleapis.com/gcm/send');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: key=YOUR_API_KEY'
]);
$result = curl_exec($curl);
print_r($result);
?>

how to make a get call with JSON and retrieve data

I am trying to follow instructions from an RFC spec to retrieve data from "certificate transparency log" known logs here
Instructions say to make a JSON call but i don't seem to be having any success.. i actually don't get any data response at all.
Here is the guide I am trying to follow:
https://www.rfc-editor.org/rfc/rfc6962#section-4.6
Here is the php code I am using
<?php
$data = array("start" => "1", "end" => "10");
$data_string = json_encode($data);
$ch = curl_init('https://ct.googleapis.com/pilot/ct/v1/get-entries');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
var_dump(json_decode($result, true));
?>
The service I was connecting to has an SSL certificate installed and was not responding to my requests. Disabling the trust verification was the solution. I added this to the CURL options CURLOPT_SSL_VERIFYPEER => false

Updating order WooCommerce API PHP CURL

I'm developing a web application for my co-workers, so they'll have an iPad with an application, to package our orders.
Whole app is almost finished, one of the last steps is to change order status from processing to completed.
What I'm doing:
Get current order ID, then change status with curl or API. What happens is very strange, I get JSON data back, and the completed_at time updated, but status is still processing.
Below you will see my code:
$data = array("status" => "completed");
$data_string = json_encode($data);
$username = 'XXX'; // Add your own Consumer Key here
$password = 'XXX'; // Add your own Consumer Secret here
$ch = curl_init('https://www.deallerleukste.nl/wc-api/v2/orders/5764?consumer_key='.$username.'&consumer_secret='.$password);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
echo $result;
Anyone who sees what I'm doing wrong? Please help!
Regards,
Jelmer
Try Using this code
$data='{ "order": { "status": "completed" }}';
or
Dynamically
$data=json_encode( array( 'order' => array( 'status' => $status)));
in $status you can pass the status u want.
I see it is a quite old post, but today I ran into the same problem, so maybe it is useful.
You have to use PUT instead of POST here:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
and data should be a valid JSON in this format:
$data='{"status": "completed"}';

Categories