Monday, December 1, 2014

How to make Tweet Auto Bot with PHP?

Leave a Comment


In this post I discuss making auto tweet twitter bot with PHPIn this case you also update your tweet without login to your twitter accout, bot is just to update the tweet so scheduled.

First create apps on twitter here to get a consumer key, consumer secret, the user token and user secret.     then download twitter library of the mat harris here then extract the htdocs folder and then rename it Tweetbot


Create a file tweet.php, for the contents of my tweets using arrays like this bellow:
 >'tweet pertama', 2 =>'tweet kedua', 3 =>'tweet ketiga',  );
 
$f = fopen('data.txt', 'r');
$i = fscanf($f, '%d');
$b = $i[0];
 
require 'tmhOAuth.php';
require 'tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
  'consumer_key'    => '', // fill with consumer key
  'consumer_secret' => '', // fill with consumer secret
  'user_token'      => '', // fill with user token
  'user_secret'     => '', // fill with user secret
));
 
$code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(
  'status' => "$quote[$b]"
));
 
if ($code == 200) {
  tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
} else {
  tmhUtilities::pr($tmhOAuth->response['response']);
}
 
$f = fopen('data.txt', 'r+' );
$count = fread($f, filesize('data.txt'));
rewind($f);
$count++;
fwrite($f, $count);
ftruncate($f, ftell($f));
fclose( $f );

Then create a file whose contents count.txt useful to be variable repetition. The contents of the file are only numbers. I use to run php cli. how to run it:
         psychology @ cmyk : ~ $ php /opt/lampp/htdocs/tweetbot/tweet.php

Note :  psychology is the name of your username website

Then to the transfers could use crontab, my example will run every hour, on the cronjob on your CPanel :

         * 1 * * * php /opt/lampp/htdocs/tweetbot/tweet.php

Perhaps more friends can develop it further in order to become more attractive as possible by using mysql to tweet or other contents.


Download FULL SOURCE HERE
Read More...

Saturday, October 18, 2014

How to redirect non-www to www with .htaccess

Leave a Comment
Hallo, Good Evening dear,
Today we will learn about "How to redirect non-www to www with .htaccess", in this case for the first word i say is .htaccess.

According to wikipedia.com, .htacces file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server's global configuration for the directory that they are in, and all sub-directories.
The original purpose of .htaccess—reflected in its name—was to allow per-directory access control, by for example requiring a password to access the content. Nowadays however, the .htaccess files can override many other configuration settings including content type and character set, CGI handlers, etc.

If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file, just do it like this :
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This will redirect any requests to http://example.com to http://www.example.com. There are several benefits from doing that:
  • It will avoid duplicate content in Google
  • It will avoid the possibility of split page rank and/or split link popularity (inbound links).
  • It's nicer, and more consistent.
 If you want to do the opposite, the code is very similar, and it's will be spesificate or live respon to your domain like this :
RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]
In this case we are explicitly typing the domain name. I'm sure it's possible to do it in a generic way, but I haven't had the time to work one out and test it. So remember to change 'my-domain' with your domain name.
thank's for read this :)
Read More...

Tuesday, September 16, 2014

FooTable: a jQuery Plugin for Responsive Tables

Leave a Comment
Here is the FooTable from JQuery, this is responsive table that we can use for our report for office, personal, and other information.

Great things and we will discussion here in bellow :
Before we say this project, download it before from this link :
Get the source from Github, or you can download it direct.



Demos & Documentation 

  1. At the head of your html just paste this code : 
    
    
    
    
  1.  It's also likely that you have your own breakpoints. That is very easy to configure as you call the plugin. 

  2. $('table').footable({
      breakpoints: {
        mamaBear: 1200,
        babyBear: 600
      }
    }); 
    
  3. And at the last setup your coloumns like this bellow :

  4.  
    
    First Name Last Name Job Title DOB Status


  5. You can quite easily tell, just from the markup, that the table will work in the following way:
    - The table will be filtered by an input with id "filter" (data-filter="#filter")
    - The table will be sorted initially by the First Name column and it will be sorted in descending order (data-sort-initial="descending")
    - The Last Name column cannot be sorted (data-sort-ignore="true")
    - The Job Title and DOB columns will be hidden on phone and tablet (data-hide="phone,tablet")
    - The Status column will be hidden on phones (data-hide="phone")
    - The DOB and Status columns use numeric data (data-type="numeric")

just see the demo in here :
DEMO SORTING

thank for read this tutorial and also i say thanks to http://css-tricks.com
Read More...

Friday, September 5, 2014

JQUERY Explainded

Leave a Comment

Today we will try to discuss language that has been growing steadily Jquery with the newest update.

JqueryIs a script-based programming language combined with the Javascript language. Jquery language helps us to facilitate the work of our website, especially for the website speed up the process of the data from the other side before displaying data to our end landing website.

Jquery inventor himself (John Resig and perfected by Dean Edwards') have tested this script, which until now has been the latest version (v2.1.1 or quoted 1:11:11 www.jquery.com) and will continue to be developed and continually refined for comfort and better capabilities and relevant in the present data on our website end landing.

Here are some examples of the application of language Jquery :

A. DOM Traversal and Manipulation 
Get the <button> element with the class 'continue' and change its HTML to 'Next Step...'
1. $( "button.continue" ).html( "Next Step..." )

B. Event Handling
Show the #banner-message element that is hidden with display:none in its CSS when any button in    #button-container is clicked.
1. var hiddenBox = $( "#banner-message" );

2. $( "#button-container button" ).on( "click", function( event ) {
3. hiddenBox.show();
4. });

C. Ajax 

Call a local script on the server /api/getWeather with the query parameter zipcode=97201 and replace the element #weather-temp's html with the returned text
1. $.ajax({

2. url: "/api/getWeather",
3. data: {
4. zipcode: 97201
5. },
6. success: function( data ) {

7. $( "#weather-temp" ).html( "<strong>" + data + "</strong> degrees" );
8. }
9. }); 
  
That's all about Jquery Script Language, if you want to ask for something please leave a comment.
For more information about Jquery please see his website at http://jquery.com
if you want download the latest Jquery just Click Here
regard's and thank's for read.
Read More...

Friday, August 29, 2014

There is no Place like 404 page??

Leave a Comment

What is 404, why not 303?or others number??

Every day if you working on Internet, you will not be foreign to hearing about 404 page not found, this code found for every client who access the page can't be show on website or webpage, or other information that users find out in Internet.
so, we will asking why?, here is some infomation to expalin this code:
HTTP code was developed by the World Wide Web Consortium named Consortiun (W3C) in 1992 as part of the HTTP 0.9 spesifications. They are defined by Tim Berners-Lee, the same man who alone find a web and a web browser the first time in 1990 Berners-Lee likens the HTTP status code with FTP status code, which has existed since 1990; FTP specifications inaugurated on 1985, although FTP has actually been used for much longer.

if we check and analisys that number, 4 (first number of 404) is: we have error on the client side, and 0(on the middle) , mean that the error get found on sintax (page line error), and 4 is show where this error found (what group of this error), it just like archieve on our filling cabinet.

404 also often redirecting on 400 : Bad Reques, 401 : Unauthorized, and etc
all of detail this number you can read on bellow, this code created by  Berners-Lee Team.

Normal Code Response :
  • “100 ; Section 10.1.1: Continue
  • “101 ; Section 10.1.2: Switching Protocols
  • “200 ; Section 10.2.1: OK
  • “201 ; Section 10.2.2: Created
  • “202 ; Section 10.2.3: Accepted
  • “203 ; Section 10.2.4: Non-Authoritative Information 
  • 204 ; Section 10.2.5: No Content
  • “205 ; Section 10.2.6: Reset Content
  • “206 ; Section 10.2.7: Partial Content
  • “300 ; Section 10.3.1: Multiple Choices
  • “301 ; Section 10.3.2: Dipindahkan secara permanent
  • “302 ; Section 10.3.3: Found
  • “303 ; Section 10.3.4: See Other
  • “304 ; Section 10.3.5: Not Modified
  • “305 ; Section 10.3.6: Use Proxy
  • “307 ; Section 10.3.8: Temporary Redirect

Server Error Side :
  • “200 ; Section 10.2.1: OK
  • “201 ; Section 10.2.2: Created
  • “202 ; Section 10.2.3: Accepted
  • “203 ; Section 10.2.4: Non-Authoritative Information
  • “204 ; Section 10.2.5: No Content
  • “205 ; Section 10.2.6: Reset Content
  • “206 ; Section 10.2.7: Partial Content
 Client Error Side:
  • 400 ; Section 10.4.1: Bad Request / Permintaan: Buruk
  • “401 ; Section 10.4.2: Unauthorized
  • “402 ; Section 10.4.3: Payment Required / Pembayaran Dibutuhkan
  • “403 ; Section 10.4.4: Forbidden
  • “404 ; Section 10.4.5: Not Found
  • “405 ; Section 10.4.6: Method Not Allowed
  • “406 ; Section 10.4.7: Not Acceptable
  • “407 ; Section 10.4.8: Proxy Authenti ation Required
  • “408 ; Section 10.4.9: Request Timeout
  • “409 ; Section 10.4.10: Conflict
  • “410 ; Section 10.4.11: Gone
  • “411 ; Section 10.4.12: Length Required
  • “412 ; Section 10.4.13: Precondition Failed
  • “413 ; Section 10.4.14: Request Entity Too Large
  • “414 ; Section 10.4.15: Request-URI Too Large
  • “415 ; Section 10.4.16: Unsupported Media Type
  • “416 ; Section 10.4.17: Requested range not satisfiable
  • “417 ; Section 10.4.18: Expectation Failed
  • “500 ; Section 10.5.1: Internal Server Error
  • “501 ; Section 10.5.2: Not Implemented
  • “502 ; Section 10.5.3: Bad Gateway
  • “503 ; Section 10.5.4: Service Unavailable
  • “504 ; Section 10.5.5: Gateway Time-out
  • “505 ; Section 10.5.6: HTTP Version not supported
we think that after read this article, you maybe know why must be 404?, and why not should other numbers, thanks for read!

Read More...