Php api to get weather forecasts and use the Apsara API to send a PHP Tutorial to friends

Source: Internet
Author: User
Use PHPAPI to obtain weather forecasts and send them to friends. The API obtains weather forecasts, and uses the Apsara API to send text messages to friends and send scheduled tasks. This allows them to automatically send weather forecasts to themselves and their loved ones on a daily basis ...? Php ######### API to obtain weather forecasts and send text messages to friends using the Apsara API
With the scheduled task, you can automatically send weather forecasts to yourself and your loved ones on a daily basis...

5 & strtolower (substr ($ url, 0,5) = "https") {curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false);} if (is_array ($ postFields) & 0 <count ($ postFields) {$ postBodyString = ""; $ postMultipart = false; foreach ($ postFields as $ k => $ v) {if ("@"! = Substr ($ v, 0, 1) // determines whether the file is uploaded {$ postBodyString. = "$ k = ". urlencode ($ v ). "&";} else // multipart/form-data for file upload; otherwise, www-form-urlencoded {$ postMultipart = true ;}} unset ($ k, $ v); curl_setopt ($ ch, CURLOPT_POST, true); if ($ postMultipart) {curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ postFields);} else {curl_setopt ($ ch, CURLOPT_POSTFIELDS, substr ($ postBodyString, 0,-1); }}$ reponse = curl_exec ($ ch); if (curl_errno ($ ch )) {Throw new Exception (curl_error ($ ch), 0);} else {$ httpStatusCode = curl_getinfo ($ ch, CURLINFO_HTTP_CODE); if (200! ==$ HttpStatusCode) {throw new Exception ($ reponse, $ httpStatusCode) ;}} curl_close ($ ch); return $ reponse;} function object_to_array ($ obj) {$ _ arr = is_object ($ obj )? Get_object_vars ($ obj): $ obj; foreach ($ _ arr as $ key => $ val) {$ val = (is_array ($ val) | is_object ($ val ))? Object_to_array ($ val): $ val; $ arr [$ key] = $ val;} return $ arr ;}?>

With the help of scheduled tasks, you can continuously send weather forecasts to yourself and your loved ones on a daily basis... ? Php #########...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.