Category : "Coding"

All kinds of Programming.

Get real IP address of user in php

Client IP address Php applications are mostly web based and often need to get the ip address of the user who is connecting to the application. Ip address is required for various logging purpose, geolocation service etc. The most common way to get the ip address of a remote user is by using the superglobal variable $_SERVER. Here is a quick example //Get ...

Remote Login with Curl PHP

Remote login with CURL The curl extension of php can be used to open remote webpages by both GET and POST methods. There are many situations when you need a php script to login into a website and open a certain page. For example when you are writing a bot or web scraper. To login we need 2 important piece of information ...

wxPython display stderr stdout window

wxpython While executing a wxpython script if a error occurs then a white window popups with some message, and it disappears fast enough before it can be read. So here is a fix to pause it and read it what and where the error in the code is : app = wx.App(redirect=False) MyFrame(None).Show() app.MainLoop() The wx.App takes this parameter called redirect which can be True ...

Create excel files in php – simple and easy way

Database applications written in php often need to export data for reporting purpose. A popular export format is excel. Excel is a spreadsheet that lays out data in a grid format. Excel itself is a microsoft proprietory format. There are many libraries available for php like Spreadsheet_Excel_Writer pear package etc that can do the job. However these libraries need to ...

Execute an sql script in jdbc

The SQL Script should have comments starting with - or -- only on new lines and each command should end with a ; . Reading a sql file and putting all of it in a string variable and feeding to the execute command would result in an exception. All instructions must be executed individually. A proper sql script should have all ...

Read write and save configurations to a file in java

Configuration files are used in applications to store settings, user preferences and other configuration parameters of an application so that. When configurations are changed from within the application these need to be saved so that next time the application starts with these new settings. In Java reading and writing to a configuration is pretty simple and straight forward. A configuration file can ...

Raw socket programming on windows with Winpcap

Raw sockets with winpcap A previous post explains how to send on windows xp. However the winsock api has limited raw socket support in windows versions greater than windows xp+sp1. Therefore winpcap has to be used to send raw packets on higher windows versions. Winpcap is a packet driver useful for packet capturing and sending raw packets on the windows ...

Tcp syn portscan code in C with Linux sockets

Port Scanning searches for open ports on a remote system. The basic logic for a portscanner would be to connect to the port we want to check. If the socket gives a valid connection without any error then the port is open , closed otherwise (or inaccessible, or filtered). This basic technique is called TCP Connect Port Scanning in which we ...

DNS Query Code in C with winsock

DNS Query Its no new fact that when we type a web address in our browser a dns request is immediately send by our browser to a DNS server to get the IP address of that web address.In winsock applications we achieve this by gethostbyname() and things are pretty simple.In this article we shall do this simple thing without the help ...

Packet Sniffer Code in C using Winsock

Winsock packet sniffer A packet sniffer is a program that can sniff the packets moving on the network. All applications communicate over the network with data packets where each packet contains part of the whole data being exchanged. A sniffer is able to pickup these individual packets and read them. In this post we are going to write a very simple packet ...



Connect with us