


Free weather forecast SMS php combined with Fetion Free weather forecast SMS
Let’s start teaching you how to do it
1. You need a PHP environment. In order to save trouble, download the APMServ software to quickly build a PHP environment. 2. Download the weather forecast SMS notification PHP program. Click here to download the code. 3. Modify the PHP program configuration. Open the WeatherForecast.php file with Notepad.
Copy the code.
The code is as follows : Copy the code The code is as follows: //Set the weather forecast city . The code is as follows: $tel['bj'] []='137XXXXXXX'; If it is a WINDOWS environment, set up scheduled tasksStart->Programs->Nearby->System Tools->Scheduled TasksAdd tasks Follow the prompts and focus on executing the program and select PHP.exe Choose the location where you installed APMServ. My local one is D:APMServ5.2.6PHPphp.exe WeatherForecast.php. My local one is D:APMServ5.2.6PHPphp.exe D:APMServ5.2.6wwwhtdocsWeatherForecast.php
The above introduces the free weather forecast SMS using PHP combined with Fetion, including the content of free weather forecast SMS. I hope it will be helpful to friends who are interested in PHP tutorials.
/**
* Fetion notification weather forecast
* 2009-4-23
*/
//Disable execution time limit
set_time_limit (0);
//Set MB encoding
mb_internal_encoding("GB2312");
/**
* Collect Sina weather forecast information
*
* @param string $city City name
* @return unknown
*/
function getWF($city){
if(empty($city)) return "";
$wf=@file_get_contents('http://php.weather.sina.com.cn/search.php?city=' .urlencode($city).'&f=1&dpc=1');
if (empty($wf)){
return "";
$star= strpos($wf,"
$return = substr($wf,$star,1000);
$end2=strpos($return,"");
$return = strip_tags(substr($return,0,$end2));
//Filter
$return = str_replace(" ","",$return);
$return = str_replace(" ","",$return);
$return = str_replace("t","",$return);
$return = str_replace("n","",$return);
$return = str_replace("℃","degree",$return);
$return = str_replace("≤","",$return);
$return = trim(str_replace("r",",", $return),",");
$return = str_replace("~","-",$return);
$return = str_replace(":",":",$return);
//Return value
return $return;
}
//Fetion account settings
$Fetion['user']='';
$Fetion['pass']='';
//Set weather forecast cities
$citys[]= array('id'=>'bj','name'=>'Beijing');
$citys[]=array('id'=>'sy','name'=>'Shenyang' );
//Beijing mobile phone number
$tel['bj'][]='137XXXXXXX';
$tel['bj'][]='137XXXXXXX';
//Shenyang mobile phone number
$tel['sy '][]='138XXXXXXXX';
$tel['sy'][]='137XXXXXXX';
if (is_array($citys)&&count($citys)>0){
//Traverse cities
foreach( { 'id']])&&count($tel[$city['id']])>0){
ceil (mb_strlen($info)/168)-1;
$qInfo=mb_substr($info,$ starj,168);
$url="http://sms.api.bz/fetion. php?username=".$Fetion['user']."&password=".$Fetion['pass']."&sendto=".$val."&message=".urlencode("Weather forecast[".$n ."],"."Tomorrow".date("Y year m month d day")." ".$city['name']." ".$qInfo);
tion[' user']."&password=".$Fetion['pass']."&sendto=".$val."&message=".urlencode("Weather forecast, tomorrow".date("Y year m month d day") ." ".$city['name']." ".$info);
Copy the code
The code is as follows:
//Fetion account settings
$Fetion['user']='your own Fetion account mobile phone number';
$Fetion['pass']='log in Fetion password';
Change your city
$citys[]=array('id'=>'bj','name'=> ;'Beijing');
Modify the mobile phone number you want to receive the weather forecast for. You can copy the code for multiple
$tel['bj'][]='137XXXXXXX';
After the configuration is completed, you can test and execute it to see if you can receive the weather Forecast information.
4. Set up daily scheduled sending

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
