Text web
In simple,it is internet on sms. The idea behind this is simple,suppose a person X is in some important work and he cannot watch tv,but he wants to know the cricket score in 4-5 seconds.Guess what ! then you think of textweb's @cricinfo or @whatsontv for knowing tv programmes. :-)
How it Works ?
Developer chooses a website he wants.Using scripting language preferably PHP(easy and simple) the website is scraped into texts and then the scraped PHP file is hosted in some free web hosting sites.Developer has to choose a tag in txtweb's developer website.So,using textweb's number a user sends a request to the textweb server and using the tag the user gives it redirects to the developers page from where the text is extracted and given back to the user. Isn't is easy and simple? Go build your own apps :-)
How to Develop a textweb app?
Step 1 : register as a developer here http://developer.txtweb.com/
Step 2: After login go to dashboard. There click on "create new service" . Have a look at the image below for reference.
Step 3: Block your service name. Check for the availability.Click save and next.Scroll down and click Go to Dashboard which is prefixed with do this later.
Step 4: Think of a useful idea and a good website which views your idea.
Step 5: Now register with a free web hosting service, you can find it in google. I use freewebhostingarea.com as it has a latest version of php.You can find a lot out there ! .
Step 6: You can test your php code either in Xampp or Lamp or Wamp by using localhost or you can directly write your scripts in free web hosting sites and check. Choice is your's.
Step 7: First check whether you are getting the webpage by copy pasting the below code with your own website url. Replace the $url with whichever link you want to scrap !
<html>
<head>
</head>
<body>
<?php
$url= "http://www.gsmarena.com/nokia_lumia_925-5451.php"
$content = file_get_contents("$url");
echo $content;
?>
</body>
</html>
Note: you can learn php from here http://www.php.net/manual/en/index.php
Step 8: View the source page of the website by right click -> View source page.
Step 9: Am referring the url http://www.gsmarena.com/nokia_lumia_925-5451.php so in 201th line you can find this <div id="specs-list">.
I need only the specs of the mobile when i choose a phone in the list developer provides me.Anyone who views this first can build the app for gsmarena :-p as no one has created one :-)
Now, i need to scrap the website from 201th line
Note: text web does not support images,it is only for text
Step 10 : As you can observe in the source page that the whole specs is in a table and each spec is in a row so how do i pick only certain rows? "Split it up".
like the code below
<html>
<head>
</head>
<body>
<?php
$msg=$_GET['txtweb-message'];
if($msg==NULL)
{
$array=null;
$content=file_get_contents("$url");
$first=strpos($content,'<div id="specs-list">');
$last=strpos($content,'</div>',$first+1);
for($i=$first;$i<$last;$i++)
{
$array=$array.$content[$i];
}
echo $array;
?>
</body>
</html>
$_GET is used to get a input from the user . While a user access a text web app he just types @whatsontv to 9266592665 so whatever scrapped website @whatsontv is linked to will be sent . suppose after that the service requires a input from the user say to choose 1.hindi 2.english blah blah! so user has to type @whatsontv 1 to 9266592665 to get the service so that 1 which is given as input is accessed by this $_GET['txtweb-message'];
Now a question for you ! how would u access multiple inputs?
Hint: to use strip_tags function in php ! try yourself ! logic is tell the user to input by seperating with a comma or a full stop or a blank space.Use Strip_tags function reference http://php.net/manual/en/function.strip-tags.php
strpos() is used to tell that the string starts from here ! strpos(' ',' ',' ') totally 3 parameters ! now observe that in the $first there is only 2 parameters ! y? because the 1st parameter is for from where that is whole website nothing but $content in the above code then 2nd parameter is from where that is <div> tag coz the specs start from there ! then is the reference parameter it is null for $first coz there is no reference as it is the first string! for $last $first is the reference ! hope u got it :-)
Step 11 : After hosting scrapping and everything is done go to dashboard in txtweb website there note down the service key and add it like the code shown below to your php script.below i have added my own service key use your own service key to get access to your service !
<head>
<meta name="txtweb-appkey" content="f760a7df-105b-4d96-bb41-ad1d6d2e14cc"/>
</head>
Step 12 : Click on the blocked service you created and provide the link of your script wherever it is hosted and proceed next -> next.
Step 13: You can check your service with the emulator in the website ! happy textwebbing !
Step 14 : Now get familiar with the php function and you are all set to develop apps !
Please comment and share this !
.
