I have bought the sim800l module and managed to connect to the internet as a client, but now I want to know if it is possible to create a GSM server with this module, I have seen examples but with the arduino libraries, which are for a sim900 module, but I have not found some AT commands that achieve the same effect, I leave you part of the source code used until now.
void iniciar(){
comandoAT("AT","OK",3000); // Comprueba que el modulo SIM800L esta arrancado
Serial.println("Conectando a la red...");
delay(3000);
while(!comandoAT("AT+CREG?","+CREG: 0,1",1000)); //Espera hasta estar conectado a la red movil
Serial.println("Conectado a la red.");
comandoAT("AT+CGATT=1", "OK", 1000); //Iniciamos la conexión GPRS
comandoAT("AT+CSTT=\"internet.comcel.com.co\",\"comcel\",\"comcel\"", "OK", 3000); //Definimos el APN, usuario y clave a utilizar
comandoAT("AT+CIICR", "OK", 3000); //Activamos el perfil de datos inalámbrico
comandoAT("AT+CIFSR", "", 3000); //Obtenemos nuestra IP
}
void peticion(){
char aux_str[50];
char direccion[] = "GET /asciilogo.txt HTTP/1.1\r\nHost: arduino.cc\r\nConnection: close\r\n\r\n";
if(comandoAT("AT+CREG?","+CREG: 0,1",1000)){ //Comprueba la conexion a la red
comandoAT("AT+CIPSTART=\"TCP\",\"arduino.cc\",\"80\"","CONNECT OK",5000); //Inicia una conexión TCP
// Envíamos datos a través del TCP
sprintf(aux_str, "AT+CIPSEND=%d", strlen(direccion));
if (comandoAT(aux_str,">",10000))
{
comandoAT(direccion, "OK", 10000);
}
}else{
Serial.print("Reiniciando...");
iniciar();
}
}
Sorry about the English.
The sim800l module is a network interface, in this case to a GSM/GPRS network.
In theory, if you set up our Adrunio as a server then it can use any interface to send and receive messages from clients, provided your network provider supports HTTP requests to that interface.
However, many mobile network providers may not allow incoming HTTP requests, and even if they do their translation between the internal IP address assigned to your modem within their network and the external IP address that you would see if you access it from the internet may change over time which could easily be an issues for your solution.
Related
I want to connect one app to linkedin in order to share content for a company page. I use symfony 5.4 in order to.
I do the following step:
create a code : ok
create a token : ok
get user credential with the token : ok
I send this request:
yes here is the response I get :
TraceableHttpClient->request('POST', 'https://api.linkedin.com/v2/ugcPosts', array('headers' => array('Authorization: Bearer AQWkl2rmtRNpKP6ir_n_y7GloBnUJI--gp6hy0xxxxxxx-xxxxx-xxxxx-LedwHSBHATYSN3878kPadWjVH9Fm-_NdDnEau0rpElZe2C4UglKTpFFZDIs2tpT1o1N_oYjWwl6AmaduaG_1v-ZS76BKrR2RLxhvDhBaqTA9U_kIWleQPpRfV_hYGYZn5ILHbSOw6PnfxFo_3UulB-8QyyeS00W8l1pAKr3cVpqxsDhfPFYZLazIGFePfaEFxlqEqZsJjSrj1jUewejLzdojs8gqcqY8_-DKexWCCuNMsFdOQNMCs5XFjw', 'X-Restli-Protocol-Version' => '2.0.0'), 'json' => array('author' => 'urn:li:person:2aw2xskWL5', 'lifecycleState' => 'PUBLISHED', 'specificContent' => array('com.linkedin.ugc.ShareContent' => array('shareCommentary' => array('text' => 'L\'assistant marketing supervise la gestion des plannings et de l\'agenda de ses supérieurs, de l\'organisation de rencontres ou des déplacements. • Occasionnellement, il peut être amené à faire de la prospective par téléphone (phoning) ou par email (mailing). • Avec le chargé d\'études, il peut mener des analyses statistiques et assurer une veille des activités de la concurrence et en matière règlementaire.'), 'shareMediaCategory' => 'NONE')), 'visibility' => array('com.linkedin.ugc.MemberNetworkVisibility' => 'PUBLIC')), 'on_progress' => object(Closure))
But when I want to share a post it throws the following error :
HTTP/1.1 403 Forbidden returned for "https://api.linkedin.com/v2/ugcPosts".
The user in linkedin has admin right on the company page and the app has the following right : r_emailaddress, r_liteprofile, w_member_social
My guess is that OAuth 2.0 scopes needs to be changed but I cannot find out where to allow access to the functionality.
I found the origin of the problem.
While requesting the token, I did not grant « share » right to it.
Every thing works fine.
I am trying to access http:///myServerName.local/ link through a client running on ESP32 after I establish the mDNS on the server running on another ESP32.
I tried implementing an HTTP request with the previous link, but it won't seem to work. I also tried just to access the link from my browser but that won't work either.
Client Code:
HTTPClient http;
Serial.print("[HTTP] begin... \n");
http.begin("http://myServerName.local/"); //HTTP
Serial.print("[HTTP GET... \n");
int httpCode = http.GET();
...
Server Code:
void advertiseServices(const char* myName)
{
if(MDNS.begin(myName))
{
Serial.println(F("mDNS responder started."));
Serial.print(F("I am: "));
Serial.println(myName);
//Add service to MDNS-SD
MDNS.addService("http", "tcp", 80);
}
else
{
while(1)
{
Serial.println(F("Error setting up MDNS responder"));
delay(1000);
}
}
}
void setup(void)
{
//Activarea serviciilor prin care putem lua legatura cu device-urile in functie de numele lor
advertiseServices("myServerName");
...
}
The only thing I got so far was -1 for httpCode and nothing else.
I'm doing integration tests with Capybara on a Ionic app that use rails in backend, and I'm having a problem after I signin successfully, the second visit does nothing and I have a timeout while waiting for angular.
# test_helper.rb
Dir[Rails.root.join("test/helpers/**/*.rb")].each { |f| require f }
require 'capybara/rails'
require 'capybara/poltergeist'
if ENV['VIEW_IN_BROWSER'] == "true"
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :firefox)
end
else
Capybara.javascript_driver = :poltergeist
end
Capybara.server_port = 3000 # serveur rails en mode test
Capybara.always_include_port = true
Capybara.default_max_wait_time = 5
Capybara.raise_server_errors = false
class ActionDispatch::IntegrationTest
# Make the Capybara DSL available in all integration tests
include Capybara::DSL
include Capybara::Angular::DSL
def setup
super
end
def teardown
super
Capybara.reset_sessions!
Capybara.use_default_driver
end
end
My helper :
#test/helpers/ionic_helper.rb
module IonicHelper
include Warden::Test::Helpers
Warden.test_mode!
def on_ionic_app
Capybara.app_host = 'http://localhost:5000' # Serveur ionic
begin
yield
rescue => error
puts error
ensure
Capybara.app_host = 'http://localhost:4321' # serveur ionic en mode intégration continue
end
end
def user_log_in
user = FactoryGirl.create(:user)
visit(Capybara.app_host+"/#/app/signin")
fill_in "email", with: user.email
fill_in "password", with: user.password
click_on "Connexion"
end
end
The first problem is that I have to specify Capybara.app_host to the visit mehod to hit the good ionic port (5000) I cannot figure why.
My second problem is is this test :
# reseau_test.rb
require "test_helper"
class ReseauTest < ActionDispatch::IntegrationTest
include IonicHelper
test "On s'assure que tous les elements en mode connecté soient présents" do
Capybara.current_driver = Capybara.javascript_driver
on_ionic_app do
user_log_in
visit(Capybara.app_host+"/#/app/network")
assert page.has_css?('span.count.following.text-center.ng-binding'), "Il doit y avoir un chiffre pour le nombre d'abonnements"
assert page.has_content?('Abonnements'), "Il doit y avoir le texte 'Abonnements'"
assert page.has_css?('span.count.follower.ng-binding'), "Il doit y avoir un chiffre pour le nombre d'abonnés"
assert page.has_content?('Abonnés'), "Il doit y avoir le texte 'Abonnés'"
end
end
end
If I remove user_log_in the tests work fine, but this page have to be seen with a logged user, and when I test it, it fails with timeout while waiting for angular. I can put the Capybara.default_max_wait_time to 30 it fails the same way.
First problem: The reason you're having issues with app_host is because you're specifying Capybara.always_include_port = true. What this does is force the port being visited to be set to the port Capybara is running a server on unless the address passed to visit has a non-default port specified. Since it doesn't look like you ever want visit to connect directly to the server being run by Capybara you should set remove it or set it to Capybara.always_include_port = false. With it false you can just set Capybara.app_host as needed and it should be used as the default start for visit
Your second issue is being caused by the JS capybara-angular is running in the page never showing the page as ready. Check for errors in your JS that could be preventing capybara-angular to have issues, or look at https://github.com/wrozka/capybara-angular/issues/20
Working on the Globalization of the Coldfusion website using the i18n.
I am using the resource files rather than database..
In my one of the string files, i have the value being displayed as:
Inicia sesión con tu nombre de usuario y contraseña.
and when i run on my browser, it is displayed as:
Inicia sesi�n con tu nombre de usuario y contrase�a.
Having read the below link, i have enabled the utf through cfprocessingdirective and the meta tag also, but i am not sure why it is still displaying it like this.
ColdFusion character encoding issue
I used the Google translate to translate the above English to Spanish.
Using this in my Application.cf also:
<cfset setLocale("English (US)")>
<!--- Set the session page encoding --->
<cfset setencoding("URL", "utf-8")>
<cfset setencoding("Form", "utf-8")>
Update #1
I cannot Update, but i am adding here:
spanish:
username=Nombre de usuario
login=Inicia sesión con tu nombre de usuario y contraseña.
appName=Inventory Manager
rem=Acuérdate de mí
slogin=Iniciar sesión
errorLoginMsg=Error! Credenciales de login fallidos, Inténtalo de nuevo
ser='Nombre de usuario' es un campo obligatorio.
ser1='Password' es un campo obligatorio.
nitem=Nuevo elemento
ilist=Lista de artículos
order=Orden
olist=Lista de Pedidos
sell=Vender
slist=Lista de Ventas
quote=Cotizaciones
qlist=Lista Cotizaciones
rs=Vuelto Vendido
inv=Factura
Russian File it is ru.rtf
username=Имя пользователя
login=Войти с именем пользователя и паролем.
appName=Inventory Manager
rem=Запомнить меня
slogin=войти
errorLoginMsg=Ошибка! Учетные данные для входа не удалась, попробуйте еще раз
ser='Имя' является обязательным полем.
ser1=Поле 'Пароль' является обязательным.
nitem=Новый элемент
ilist=Список статей
order=Заказать
olist=Список Заказать
sell=Продать
slist=Список продажам
quote=Цитаты
qlist=Котировки Список
rs=Продано Возвращается
inv=Счет
how can I use nltk in python to extract information from web page (job offers in my case)
I use this code to extract a part of text ,
import nltk
import time
import urllib2
from urllib2 import urlopen
from cookielib import CookieJar
import datetime
website = "http://tanitjobs.com/search-results-jobs/"
topSplit = "<div class=\"offre\">"
ButtomSplit = "<div class=\"offre-emploi \">"
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('Uer-agent', 'Mozilla/5.0')]
def main():
try:
ss =opener.open(website).read()
sourceCodeSplit = ss.split(topSplit)[1].split(ButtomSplit)[0]
texte = nltk.clean_html(sourceCodeSplit)
print texte
except Exception,e:
print 'fail in the main loop'
print str(e)
main()
but I don't know how to do it if I would extract specific paragraph (job offers) from a web page in general
Firstly, you will need urllib.request from python3, see http://docs.python.org/3.0/library/urllib.request.html
Next, BeautifulSoup is your friend: http://www.crummy.com/software/BeautifulSoup/bs4/doc/. I find this useful in installing bs4 in py3.x see http://annelagang.blogspot.fr/2012/11/beautifulsoup-4-for-python-3x.html
Here's a working example:
import urllib.request
from bs4 import BeautifulSoup as bs
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
headers={'User-Agent':user_agent,}
url="http://tanitjobs.com/search-results-jobs/"
request=urllib.request.Request(url,None,headers) #The assembled request
response = urllib.request.urlopen(request)
data = response.read()
for i in bs(data).find_all(attrs={"class": "offre-emploi vedette"}):
print(" ".join(i.find("div",attrs={"class":"detail"}).text.split()))
print
[out]:
Téléopérateurs (trices) Quality Com Center QualityCom sis a
Montplaisir recrute des téléopérateurs (trices), en... Voir toutes les
offres de Quality Com Center
Contrôleur de gestion Eureka Developpement Humain Pour le compte d’une
Multinationale dans le domaine de l'industrie, nous recrutons un :...
Voir toutes les offres de Eureka Developpement Humain
Responsable ressources humaines (H/F) Eureka Developpement Humain Pour
son propre compte Eureka Développement Humain Recrute : Responsable...
Voir toutes les offres de Eureka Developpement Humain
Contrôleur Financier Junior Proxy Tunisie Rattaché au Directeur
Administratif et Financier pays, votre rôle est de garantir la
gestion... Voir toutes les offres de Proxy Tunisie
Superviseur en prise de rdv ( énergie renouvelable ) Quality Com
Center Quality Com Center sis a Montplaisir Recrute 1 Superviseur(e)
en Panneaux... Voir toutes les offres de Quality Com Center
Téléconseillers (h/f) Axess global services AXESS GLOBAL SERVICES
Recrutement Vous souhaitez travailler dans une Enterprise jeune et...
Voir toutes les offres de Axess global services