I should use php or python to make web crawler? [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I learning about web-crawling and I and don't know whether to use php or python. I want to make a website that takes information from another website and automatically updating.
And does it possible to make a decent website with python? or I have to paste the information from python to html or php?

It depends a bit one the nuances. PHP is a language mainly used to develop websites (to present them), whereas Python is used for both programming websites and programming other applications. Thus, it depends on how application-like the scraping will be or how much it will be included into the (presentational) website.
Python is well-suited for scraping tasks as it has a lot of third party libraries (Scrapy, BeautifulSoup, lxml, request, ...) and also built in libraries for requesting URLs. With PHP you will have a harder life requesting other websites. As said, it is mainly focused on building an own website.
Also it of course depends on your skill level in each language.
I'd split the application into two parts anyway:
presentation logic (your own website)
scraping logic (scraping other websites)
Both will be connected through a database. The scraping logic collects information and stores it into the database. The presentation logic takes information from the database and displays it to the user as HTML.
For the scraping part, you then want to prefer Python over PHP. And for the presentation part, it actually does not matter and is a matter of preference or knowledge.

Related

It is best to generate the html content through php classes? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been playing around in the Web Development field for 2 years now and I am pretty proud when it comes to my progress as a programmer looking back at my humble beggining. This is not very relevant but I've wanted to back up my question with some background story. What it comes to my interest during a conversation with a friend was how to best structure your code when it comes to a website so it wil be very scalable for further modifications using an oop aproach. He suggested at the end of the discusion to use php classes to generate the html content. I personally use it like this only when the php helps me to retrieve something server-side related. I use HTML, CSS and JavaScript (in that order) as much as possible before calling in PHP. That's how it should work, in my opinion, especially when you have to work on a presentation website for example. What's intrigue me thinking about my friend proposal is that I structure my code that way using php clases to echo html content parts like header, menu, forms, slideshows, footer etc. will indeed scale my code way better and help my programming skills progress. I should end up with an index.php that returns objects of the respective classes creating that way the desired html content. This is how I image things working and I am asking you to help me reach a decision. I have some upcoming free time available and I want to invest it in becoming a better web developer.
It is generally a bad idea for all HTML to be generated this way.
In professional web development you often have front-end developers and designers whose only responsibility is the HTML/CSS/assets and/or JavaScript. The backend developers, (the ones writing PHP code), are usually responsible for the business logic of the application.
By having PHP generate HTML you are violating separation of concerns principles. Things will get messy. It's harder to scale up, and you will lose the benefits of being able to use a HTML editor.
Generating HTML serverside dynamically has uses in very specific circumstances. It can be done, but just because you can, doesn't mean you should.

a website design : how do I combine node.js with php? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am planning to make a website which shows location information up.
The thing is, since the pages will be interactive to users and I am thinking of using node.js and mongoDB(pretty capable for node.js isn't it?).
Please recommend me which languages are fitting on node.js & mongoDB.
Python? or should I use jade for the development?
and plus, will be PHP Codeigniter helpful?
(I am used to developing with PHP and I am wondering if PHP & node.js combination is nice)
Thanks in advance.
Generally I'd prefer not to use two different languages for comparatively simple applications (if your usecase is simple). There might be usecases where you can't avoid this, for example you have to use libraries that only exist in either one of the languages.
I'd use Jade with ExpressJS as Backend, however I consider the template language to be a highly personal Choice. See http://expressjs.com/api.html for an ExpressJS example
See https://npmjs.org/browse/depended for a list of popular NodeJS packages. Some people prefer to use EJS (embedded javascript) or ECO (embedded coffeescript) or one of numerous other templating systems instead of Jade.
Please also consider to use CoffeeScript instead of writing the JS yourself (CoffeeScript is automatically converted into JS. It adds some neat features that are easy to get wrong when you're writing plain JS.
From a performance standpoint, NodeJS is best when you have many API calls that return a small amount of data. I've made good experiences with ExpressJS performance using Jade as backend.
I can recommend the NodeJS beginner book, however, this is, as always, highly subjective.
It's difficult for me to Judge if Python might be a better solution. I recommend you take a look at Tornado together with Jinja2 as template engine. NodeJS can sometimes get quite a callback hell, because of the way it does its asynchronicity, see e.g. http://callbackhell.com/
Note that in any case, for increased security and fast static file (CSS, JS) delivery, you might want to add a reverse proxy layer (Nginx usually provides better performance, but Apache works as well) before the NodeJS/Python server.

PHP v/s JSP (on the basis of security) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm a beginner web developer knows both PHP and JSP coding formats
I found lots pages on internet the all told that PHP is less secure than JSP.
but they all almost are old pages may be updated 2-3 years ago. Here I'm referring some forum links
Is JSP a good alternative to PHP [closed]
ASP - PHP - JSP ... which is better?
Now as every year new version PHP are releasing with lots of new features Like OOP, PHP Filters etc.
My question is that is PHP still less secure than JSP? if yes, than i want to know that what facts that makes PHP less secure than JSP. Please explain with examples if possible.
According to my opinion, It's the developer(means developer's code) who's responsible for security.
But i still want to know other programmers opinions
Any Help is appreciated
"According to my opinion, It's the developer(means developer's code) who's responsible for security"
Smart programming languages add up more layers which most of the time is in price of performance. Much of security on web applications is checking client input (uploaded file, form entries, URL...) to be same as expected. Smart languages do much of the work automatically. Also they have built-in security schemes which are prone to bug if you write them yourself.
I believe security is not the main concern for selecting the platform but should be considered besides performance, budget, maintenance...
Note: Security is not just about web application programming, you may get hacked from upper layers like other applications on the same web server, at operating system level...

What types of websites should I choose to build using Ruby on Rails over PHP? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have read many advantages of Ruby on Rails over PHP with a platform. However, it seems like Ruby on Rails is limited compared to PHP with a platform. Is there any special types of websites, such as blog, portfolio, ecommerce, job-search, content management website and etc., where I should choose Ruby on Rails over php with a platform?
For example, I've been meaning to build a ecommerce website with multi-vendors. However, many people recommended using PHP. Also, when I looked through the popular website examples using RoR, majority of website seemed like company websites with limited contents, portfolios, or websites with video links.
Rails is an MVC framework, PHP is a language. You might look into "Cake" for a proper comparison.
Rails will do anything you want it to do*. A lot of this comes from the rubygem ecosystem, most of which are usable without rails.
Out-of-the-box, with no other alterations, Rails provides really convenient places to describe your data (the models), figure out what data should be used to respond to requests (the controllers), and how to show that data as an HTML web page (the views).
*Except be faster than micro frameworks (sinatra, flask, ~ node)
I would not use rails to build something the size of Twitter or Facebook. I would definitely use Rails to build the first versions of Twitter and Facebook that hit the web.
I frequently refer to Rails as "a website in a can". As such, it is excellent for every example on your list, although it'd likely be overkill for a portfolio because you don't need the database.
Finally, if your problem is in any way a common one? If you are seeking to build a "normal" sort of website? If you think other people have solved the same problems you are trying to solve? Rails (plus gems) will do it for you, and keep you happy* while you do it.
I have an interview question: Build me a website with users who have avatar pictures. One guy literally did it one line of bash prompt, via the rails-composer tool.
Remember - There are basically two principles in RoR. One, from Ruby - "Maximize Developer Happiness", and one, from Rails - "Convention over Configuration". AKA, you will enjoy yourself, and frequently have to do nothing.

Startup building and mokup [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
since about two years ago, I did find my interest in code (Hardware/Sytems/Web) and now, I've found a project which motivates me a lot (It takes all my free time indeed).
Starting this point and because my project could soon switch from a free time project to a daily job, I'm currently developing a mockup of this project based on PHP/MySQL and JQuery.
Even if I'm a true Python/MongoDB lover and a System Engineer, I did prefer those technologies to build up my mockup because of their simplicity to build a complete functional private stack at home.
I'm pretty advanced on my mockup and it seems to work as I want it.
Now I'm wondering if, about your point of view, would have been better to start to build my mockup using directly the targeted technologies (Python/MongoDB) rather than to use the easy PHP/MySQL couple to do it?
Obviously, because I plan to made this project my daily job, I had to have something visually functionnal to be able to raise a little bit of money, and about me, using an easier stack it's more easy, but I would like to have your feedback on this kind of question.
The idea that PHP/MySQL is easier or simpler than say Python/MongoDB is just inconsistent.
If you compare for example, Django (the most popular python web framework) with symfony(PHP) you will find that they are almost identical in terms of features and architecture (symfony is actually slightly more complex but also has more very advanced features).
For mockups, if I were you, I would use solely HTML/jQuery/CSS.
Build your pages just like you would like to have them in your beta version, use jQuery to load sample data written in json.
That's all you need. You can even find WYSIWYG application to speed up the process.
Later on, you can build the back-end application using either python or php, it won't matter.
The integration process will be identical, create your models, create the controllers, and use the HTML you already have as templates.
Building your app in php/mysql then convert it to python/mangodb will make you rewrite almost all the code simply because python is so much different from php (easier I would say too, but that's just my opinion) and because mangodb is not a relational database meaning you will have also to rethink partially your architecture.

Categories