PHP Debugger

How to debug your PHP project

It is assumed that the server is installed locally to work (php apache mysql etc ...).

Get Eclipse from here

On Eclipse go to Run -> Debug Configurations
Click new configuration

new configurations image new configurations image

Folder: Server
*Name: php-debugger (can chose another name, of course! :) )
*PHP server - default PHP Web Server
*File: /newProject/index.php
Open configure...
*Debugger: xdebug
*base url: http://localhost
*local web root: /var/www/html/newProject
*OK
*new configurations image

Folder: Debugger
*Server Debuger --> XDebug
APPLY
CLOSE

go to /var/www/html and create a new folder "newProject"

Create a PHP Project in eclipse (using, of course, the folder you created)

Create new file index.php with some code to text and set a breakpoint with double click on the left side of the code

Open php.ini
sudo gedit /etc/php5/apache2/php.ini
past the code

code:
xdebug.remote_enable = On
new configurations image
save the file and exit
restart apache: sudo /etc/init.d/apache2 restart

new configurations image

Run, Debug as... , PHP web application

new configurations image

Will open a web browser inside eclipse

________
ZXCoders

Email Web Crawler


This simple python script allow you to scan websites looking for email addresses.

In the begin, you have to set a seed url to have a initial point to scan

code:
urlsToProcess = deque(['https://moz.com/top500']) 

In the main loop (who runs until there is no more urls) process url looking for more urls to feed the deque urlsToProcess

code:
url = urlsToProcess.popleft()
    processed_urls.add(url)
     
    urlsFile.write(url + "\n")
    
    parts = urlparse(url)
    base_url = "{0.scheme}://{0.netloc}".format(parts)
    path = url[:url.rfind('/')+1] if '/' in parts.path else url
 
    print("Crawling site: %s" % url)
    try:
        response = requests.get(url)
    

for anchor in soup.find_all("a"):
        # extract link
        link = anchor.attrs["href"] if "href" in anchor.attrs else ''
        if link.startswith('/'):
            link = base_url + link
        elif not link.startswith('http'):
            link = path + link
        # add url to the the list
        if not link in urlsToProcess and not link in processed_urls:
            urlsToProcess.append(link)

And scan and save the emails in a file.

code:
new_emails = set(re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.[a-z]+", response.text, re.I))
    
    for email in new_emails:
        if email not in emails:
            emailsFile.write(email + "\n")
            emails.add(email)

To donwload the full script clone/fork it from bitbucket zxcoders

PHP - Run your python from web

executer print screen

Have you ever need to run some python script's in you server?

If you need to run , and it's helpfull to do it from a web page where is a script to help you.

Is a very simple script just in one php file. Fell free to copy, share, and modify



LINK to BitBucket

Make your icons for android app's

Launcher Icon Generator is a very simple and usefull online app to make your icons to android apps. try it! :)

romannurik.github.io/AndroidAssetStudio/icons-launcher.html

Tags:

Ruby on Rails

Ruby on Rails

Ruby on Rails is an open framework that promises to increase speed and ease of website development-oriented database (database-driven web sites), since you can create applications based on pre-defined structures. Optimized for programmer happiness and sustainable productivity, it lets you write beautiful code by favoring convention over configuration. Often referred to as Rails or RoR, Ruby on Rails is an open source project written in the Ruby programming language. Applications created using the Rails framework are developed based on the MVC architectural pattern (Model-View-Controller).

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

Rails was created in 2003 by David Heinemeier Hansson and has since been extended by the Rails core team and more than 3,700 contributors. Tens of thousands of Rails applications are already live. People are using Rails in the tiniest part-time operations to the biggest companies.


To learn Ruby on Rails we have a great coursera course “Web Application Architectures” (begin a week ago, you still have time to chatch this), where we can learn how to build and deploy modern web application architectures – applications that run over the Internet, in the "cloud," using a browser as the user interface.

___
MM

Pages

Subscribe to ZXCoders Blog RSS