Ik probeer via een PHP script via het internet en een betaalde SMS gateway SMSjes te versturen. Hiervoor heb ik:
- bij BigFoot een account en daar krijg je toegang tot hun SMS gateway. Voor de programmering hebben ze de richtlijnen van hun API bijgevoegd.
- de stappen in deze API zijn kort:
- een php file waarnaar gepost wordt door het formulier:
Met bovenstaand script krijg ik de gegevens verzonden naar de gateway, en ontvang niet veel later ook een SMS, maar hierbij is:
- de naam van de afzender slechts gedeeltelijk ontvangen (DJKevin2U);
- het bericht in rare tekentjes weergegeven;
Ik vermoed dat er iets in het PHP script niet klopt met betrekking tot de coding of iets dergelijks. Ik heb de variabelen uitgelezen en deze bevatten allen de juiste informatie.
kan iemand mij helpen?
- bij BigFoot een account en daar krijg je toegang tot hun SMS gateway. Voor de programmering hebben ze de richtlijnen van hun API bijgevoegd.
- de stappen in deze API zijn kort:
- 2.1. CONNECTING TO THE BIGFOOT SMS GATEWAY SERVER The client should send HTTP POST form requests to the gateway (Bigfoot SMS Server) and wait for the gateway's response. The following URLs are used to connect with the gateway:
http://smsgateway.bigfoot.com:8080/services/smsgateway for sending message
and
http://smsgateway.bigfoot.com:8080/services/originator for requesting the validity of originator number.
Connections should be made to the symbolic DNS of the gateway, instead of the IP address because the IP address of the gateway is subject to change without prior notice. - 2.2. TRANSMITTING SUBMISSIONS TO THE BIGFOOT SMS GATEWAY SERVER The client should transmit submissions by HTTP POST request to the gateway. It is also the client's responsibility to compose the request. Submissions sent to the gateway should conform to Sections 2.2.1 and 2.2.2, as well as RFC 2616.
- 2.2.1. HTTP Sequence 1.
Client should connect to the gateway (see section 2.1 for URLs).
2.
Client then transmits the HTTP POST request. The request URI for sending SMS is: /services/smsgateway
The request URI for validating the originator number is: /services/originator
Requests should contain the following HTTP headers:
Content-type: application/x-www-form-urlencoded
Accept-charset: utf-8
Content-length: xxx (where xxx is the length of the body)
The definitions and values of the attributes of the HTTP POST request body should conform to Section 2.2.2
The client should not close the connection after the transmitting request in order to receive a reply from the gateway (see section 2.3). - 2.2.3. Text Messages The ETSI GSM 03.38 character set encodes characters intended for display in the Text Message. Characters in the Text Message are therefore limited only to those available in that particular character set. Please go to this URL to see other existing character sets for encoding: http://www.unicode.org/Public/MAPPINGS/ETSI/GSM0338.TXT
For the other mobile service carriers and other types of mobile phones employing the other existing character sets, Bigfoot cannot guarantee that the text message will send or display correctly. This is because Bigfoot cannot configure the specific transmission and display capabilities for all the different types of mobile phones in the world. However, most mobile service carriers and mobile phones of various make and model - except for those used in the United States - are capable of transmitting and displaying ETSI GSM 03.38 characters.
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="sms.php" method="post" enctype="multipart/form-data"> <input name="username" type="text" value="mijnusername"> <input name="password" type="text" value="mijnwachtwoord"> <input name="test_mode" type="text" value="no"> <input name="type" type="text" value="text"> <input name="text" type="text" value="Dit is een test om te kijken of het werkt!"> <input name="numbers" type="text" value="+31612345678"> <input name="originator" type="text" value="DJKevin2K"> <input name="version" type="text" value="1.0"> <input name="submit" type="submit" value="submit"> </form> </body> </html> |
- een php file waarnaar gepost wordt door het formulier:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header .= "POST /services/smsgateway HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Accept-charset: utf-8\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ("smsgateway.bigfoot.com", 8080); if (!$fp) { echo "error ". $req; } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); } fclose ($fp); } |
Met bovenstaand script krijg ik de gegevens verzonden naar de gateway, en ontvang niet veel later ook een SMS, maar hierbij is:
- de naam van de afzender slechts gedeeltelijk ontvangen (DJKevin2U);
- het bericht in rare tekentjes weergegeven;
Ik vermoed dat er iets in het PHP script niet klopt met betrekking tot de coding of iets dergelijks. Ik heb de variabelen uitgelezen en deze bevatten allen de juiste informatie.
kan iemand mij helpen?