How can I send a message to a whatsapp group using chat-api - whatsapp

Hello Im using this library (https://github.com/chatapi/whatsApp-php) to send messages by whatssapp. I see the client object has the following methods:
[0] => getInstance
[1] => sendMessage
[2] => getMessages
[3] => getStatus
[4] => getQrCode
[5] => createGroup
[6] => sendFile
[7] => setWebHook
[8] => getWebHook
[9] => logout
[10] => reboot
[11] => getMessagesQueue
[12] => clearMessagesQueue
The question is: How can I send a message to an exist group? is it possible at all using this library?
Thank you.

It seems like the php api isn't full.
Using raw http api you can send dialogs request, find the group chatId, and send it to sendMessage request.

Related

omnipay payment wall integration -Error

I tried to implement paymentwall payment gateway integration with Laravel using omnipay library.After setting setApiType, setPublicKey and setPrivateKey and trying to call the API, its getting the response "Public key is missed or invalid" from payment wall gateway.
Actually this error is happened due to passing parameter public key as public_Key instead of public_key from the omnipay library.
The following is the response
[request:protected] => Omnipay\PaymentWall\Message\PurchaseRequest Object
(
[endPoint:protected] => https://api.paymentwall.com/api
[parameters:protected] => Symfony\Component\HttpFoundation\ParameterBag Object
(
[parameters:protected] => Array
(
[apiType] => 0
[publicKey] => hjghjghsdfsc5464564564e56456
[privateKey] => gfh4567686786787hfjfhgfgfgh
[amount] => 10.00
[currency] => USD
[accountId] =>
[description] => test Pay
[email] => test#gmail.com
[clientIp] => 112.133.236.158
[browserDomain] => test.com
[card] => Omnipay\Common\CreditCard Object
[response:protected] => Omnipay\PaymentWall\Message\Response Object
*RECURSION*
[zeroAmountAllowed:protected] => 1
[negativeAmountAllowed:protected] =>
)
[data:protected] => Array
(
[type] => Error
[object] => Error
[error] => Public key is missed or invalid
[code] => 2111
[log] =>
)
)
Public key is missed or invalid
As I commented in the issue that you raised on github:
This is working for everyone else. Are you sure there isn't really an issue with your keys? Can you check that there are no spurious newlines, etc, in your key as provided to the library?
The correct name for the public key parameter within Omnipay is publicKey. The correct name within the paymentwall library is public_key. A check of the code appears to indicate that the parameter naming is correct. The Omnipay publicKey parameter is correctly passed to the paymentwall library as public_key.

How to set http timeouts for Amazon AWS SDK for PHP

I'm using the Amazon AWS SDK for PHP (namely, version 2.7.16) to upload files to an S3 bucket. How can I set a timeout for http/tcp operations (connection, upload, etc.)? Although I've googled a lot I wasn't able to find out how.
Sample code I'm using:
$awsS3Client = Aws\S3\S3Client::factory(array(
'key' => '...',
'secret' => '...'
));
$awsS3Client->putObject(array(
'Bucket' => '...',
'Key' => 'destin/ation.file',
'ACL' => 'private',
'Body' => 'content'
));
so I'd like to set a timeout on the putObject() call.
Thanks!
Eventually I helped myself:
$awsS3Client = Aws\S3\S3Client::factory(array(
'key' => '...',
'secret' => '...'
'curl.options' => array(
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 10,
)
));
Looks like AWS PHP uses curl internally, so network related options are set this way.
With SDK version 3 this can be configured using the http configuration key.
$awsS3Client = Aws\S3\S3Client([
'key' => '...',
'secret' => '...',
'http' => [
'connect_timeout' => 5,
'timeout' => 10,
]
]);

IPN Response: WP_Error Object, SSL connect error, Error response: SSL connect error

We have multiple Woo Commerce stores set up however one we have a SSL Certificate applied to it.
On the one with the SSL certificate we get the Error "Error response: SSL connect error" in the Woo Commerce pay pal Logs. Has anyone got any clue as to what the reason could be.
I have tried changing the notify URL to a http connection instead but it still produces the same issue.
WooCommerce PayPal Log below
01-29-2016 # 10:25:25 - Generating payment form for order 1869. Notify URL: https://frictionfreeshaving.com/wc-api/WC_Gateway_Paypal/
01-29-2016 # 10:25:48 - Checking IPN response is valid
01-29-2016 # 10:25:48 - IPN Request: Array
(
[body] => Array
(
[cmd] => _notify-validate
[transaction_subject] => Subscription 1870 (Order 1869) - test-razor
[payment_date] => 02:25:44 Jan 29, 2016 PST
[txn_type] => subscr_payment
[subscr_id] => I-0TFMV85ERGCJ
[last_name] => singh
[residence_country] => GB
[item_name] => Subscription 1870 (Order 1869) - test-razor
[payment_gross] =>
[mc_currency] => GBP
[business] => tjmailcoms#gmail.com
[payment_type] => instant
[protection_eligibility] => Ineligible
[verify_sign] => ALUw10OT3.wkDPQ73JiKtXApC16gA24mWOunWinyGFBel4bkL0L8u3O-
[payer_status] => verified
[test_ipn] => 1
[payer_email] => tjmailcoms03#gmail.com
[txn_id] => 41285066KK228700R
[receiver_email] => tjmailcoms#gmail.com
[first_name] => tejinder
[invoice] => WC-10011869
[payer_id] => M7A8DVMKC4GCW
[receiver_id] => XK2LNP4PTGQUU
[payment_status] => Completed
[payment_fee] =>
[mc_fee] => 0.23
[mc_gross] => 1.00
[custom] => {"order_id":1869,"order_key":"wc_order_56ab3e14c01b3","subscription_id":1870,"subscription_key":"wc_order_56ab3e14e7922"}
[charset] => windows-1252
[notify_version] => 3.8
[ipn_track_id] => f7146428bb012
)
[timeout] => 60
[httpversion] => 1.1
[compress] =>
[decompress] =>
[user-agent] => WooCommerce/2.3.11
)
01-29-2016 # 10:25:48 - IPN Response: WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => SSL connect error
)
)
[error_data] => Array
(
)
)
01-29-2016 # 10:25:48 - Received invalid response from PayPal
01-29-2016 # 10:25:48 - Error response: SSL connect error
01-29-2016 # 10:25:52 - Checking IPN response is valid
01-29-2016 # 10:25:53 - IPN Request: Array
(
[body] => Array
(
[cmd] => _notify-validate
[txn_type] => subscr_signup
[subscr_id] => I-0TFMV85ERGCJ
[last_name] => singh
[residence_country] => GB
[mc_currency] => GBP
[item_name] => Subscription 1870 (Order 1869) - test-razor
[business] => tjmailcoms#gmail.com
[recurring] => 1
[verify_sign] => AFUzd6d5BFLcPs.756upyW0L6Uo6A-NLMyaoJ69kQZg1yL4yEsY4gTMf
[payer_status] => verified
[test_ipn] => 1
[payer_email] => tjmailcoms03#gmail.com
[first_name] => tejinder
[receiver_email] => tjmailcoms#gmail.com
[payer_id] => M7A8DVMKC4GCW
[invoice] => WC-10011869
[reattempt] => 1
[subscr_date] => 02:25:42 Jan 29, 2016 PST
[custom] => {"order_id":1869,"order_key":"wc_order_56ab3e14c01b3","subscription_id":1870,"subscription_key":"wc_order_56ab3e14e7922"}
[charset] => windows-1252
[notify_version] => 3.8
[period3] => 1 D
[mc_amount3] => 1.00
[ipn_track_id] => f7146428bb012
)
[timeout] => 60
[httpversion] => 1.1
[compress] =>
[decompress] =>
[user-agent] => WooCommerce/2.3.11
)
01-29-2016 # 10:25:53 - IPN Response: WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => SSL connect error
)
)
[error_data] => Array
(
)
)
01-29-2016 # 10:25:53 - Received invalid response from PayPal
01-29-2016 # 10:25:53 - Error response: SSL connect error
01-29-2016 # 10:30:08 - Checking IPN response is valid
01-29-2016 # 10:30:09 - IPN Request: Array
(
[body] => Array
(
[cmd] => _notify-validate
[txn_type] => subscr_cancel
[subscr_id] => I-0TFMV85ERGCJ
[last_name] => singh
[residence_country] => GB
[mc_currency] => GBP
[item_name] => Subscription 1870 (Order 1869) - test-razor
[business] => tjmailcoms#gmail.com
[recurring] => 1
[verify_sign] => Am729F3QdZ4ucintGF7EZMXFQKlgAKfHAWYr4ohDcQkhr0xx0H34n8lT
[payer_status] => verified
[test_ipn] => 1
[payer_email] => tjmailcoms03#gmail.com
[first_name] => tejinder
[receiver_email] => tjmailcoms#gmail.com
[payer_id] => M7A8DVMKC4GCW
[invoice] => WC-10011869
[reattempt] => 1
[subscr_date] => 02:29:50 Jan 29, 2016 PST
[custom] => {"order_id":1869,"order_key":"wc_order_56ab3e14c01b3","subscription_id":1870,"subscription_key":"wc_order_56ab3e14e7922"}
[charset] => windows-1252
[notify_version] => 3.8
[period3] => 1 D
[mc_amount3] => 1.00
[ipn_track_id] => 542b79c8e6b4
)
[timeout] => 60
[httpversion] => 1.1
[compress] =>
[decompress] =>
[user-agent] => WooCommerce/2.3.11
)
01-29-2016 # 10:30:09 - IPN Response: WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => SSL connect error
)
)
[error_data] => Array
(
)
)
01-29-2016 # 10:30:09 - Received invalid response from PayPal
01-29-2016 # 10:30:09 - Error response: SSL connect error
Due to this no orders are being processed but payment is being taken. Any help would be greatly appreciated as I'm out of ideas.
Tj
Copying my previous answer from here:
Paypal have recently rolled out some security updates on the sandbox (production will be updated in June) https://devblog.paypal.com/upcoming-security-changes-notice/
Most importantly, TLS 1.0 and 1.1 are no longer accepted by the sandbox, so you'll need to make sure that TLS 1.2 is being used by forcing the curl option, e.g:
$curl->setOption(CURLOPT_SSLVERSION,6);
You'll need OpenSSL 1.0.1+ for this to work. You can wait for woocommerce to release a patch themselves, or you can make TLS 1.2 work automatically (the common cipher will be deduced during the SSL handshake) by updating to PHP 5.5.19+ and (lib)curl 7.34+.

Is there any concept like google plus app access token

I am currently developing an app for Google+. Is there any way to fetch/search public data with out user authentication, I mean, using an app access token
https://www.googleapis.com/oauth2/v1/activities
Yes, see https://developers.google.com/+/api/oauth#apikey which talks about using an API Key instead of using a user login.
Quoting that page:
For Google+ API calls that do not need to identify a particular user, you can use your application API key. This is useful for server-side applications, or web applications that do not require the user to sign in with Google.
[...]
After you have an API key, your application can append the query parameter key=yourAPIKey to all request URLs. The API key is safe for embedding in URLs; it doesn't need any encoding.
You can get the API key via the new Developers Console by going to http://console.developers.google.com/ and selecting your project, then clicking on the APIs & auth tab on the left and then Credentials. There should be a section on the right Public API Access with a button to press to create a new key if one doesn't already exist.
Still no luck,
Here is the response :
Array
(
[url] => https://www.googleapis.com/oauth2/v1/activities?query=stackoverflow&maxResults=100&orderBy=recent&key=54XXXXXXX4723.apps.googleusercontent.com
[content_type] => text/html; charset=UTF-8
[http_code] => 404
[header_size] => 390
[request_size] => 262
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.813163
[namelookup_time] => 0.411874
[connect_time] => 0.454496
[pretransfer_time] => 0.605186
[size_upload] => 0
[size_download] => 9
[speed_download] => 11
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => 0
[starttransfer_time] => 0.813109
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip] => XXX.XXX.XXX.XX
[primary_port] => 443
[local_ip] => 192.XXX.XXX.XXXX
[local_port] => 52227
[redirect_url] =>
)
The answer around the key is correct for general public access. However, the URL you are using is not correct. You want the activities list API I suspect: https://developers.google.com/+/api/latest/activities/list
GET https://www.googleapis.com/plus/v1/people/{userId}/activities/public?key={YOUR_KEY}

PHP_Incomplete_Class Object / Different responses from print_r

When I issue a print_r ($_SESSION) on my local server I receive the following
Array
(
[group] => Rich Primosch
[ok] => 1
[golfer] => Fritz Davis
[uniq] => 38
[fname] => Fritz
[lname] => Davis
[hphone] => 352-487-0597
[cphone] => 352-487-6189
[email] => fritz#hadleyvillage.org
[vid] => 527571
[handicap] => 23
[admin] => 0
[page] => signup.php
)
However when I issue the same print_r ($_SESSION) on the webhost's server I get this response
Array
(
[group] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => window
[curdate] => 1293771600
[datetime] => 1293813211
[monplay] => 1294030800
[wedplay] => 1294203600
[friplay] => 1294376400
[monclose] => 1293750000
[wedclose] => 1293922800
[friclose] => 1294030740
[monopen] => 1293426000
[wedopen] => 1293426000
[friopen] => 1293426000
[ismonopen] =>
[iswedopen] => 1
[isfriopen] => 1
)
[ok] => 1
[golfer] => mysqli_result Object
(
)
[uniq] => 175
[fname] => Fritz
[lname] => Davis
[hphone] => 352-487-0597
[cphone] => 352-487-6189
[email] => fritz#hadleyvillage.org
[vid] => 723234
[handicap] => 23
[admin] => 0
[page] => signup.php
)
Why I even see the incomplete class object, I have no idea. It is never assigned to a $_SESSION variable and yes, the class definition is included before session_start().
There are several differences in the two responses. My question is why? Is there a difference in settings somewhere or is there a programming error.
I have seen many references to the PHP_Incomplete_Class Object but they all say make sure that the class definition proceeds session_start. In my case it does but that should be inconsequential because I only use the object on one page and do not store it in a session.
Suggestions are appreciated.
-dmd-
try var_dump instead in both machines, it may say something interesting, "group" value seems to be an object, of what type? does it have a __sleep() magic method?
ensure your test machine and production server has the same php version to better understand the issue.
#see http://www.php.net/manual/en/language.oop5.serialization.php