Questions about Javascript and PHP

by 15 replies
17
I'm in school right now learning C++ and other programming courses in my CIS classes. I"m also a fledgling internet marketer with a strong(focused) plan of attack.

I've read many posts in this section of the forum on PHP but I have heard little about javascript. I'm thinking about coding a website scraper and want to use either php or javascript and I'm not sure which way to go. It seems like most people prefer php above and beyond other languages, but javascript doesn't seem to get much of a mention.

Can anyone clarify why php might be better than javascript and which language would be better to code a website scraper program?

Thanks a lot everyone!
#programming #javascript #php #questions
  • PHP is better to understand coz it is quite easy to learn and syntax arenot too complex as javascript. javascript developed by Nowell netware and u have to declare lots of classes and have to check the compatibility of it with oither languages too.
    PHP can be practiced through different IDE's like dreamweaver, artisteer, php designer but javascript cant be practiced on these simple plateforms. It requires netbeans or myeclipse where uhave to declaremany things by urself totally depends on ur knowledge thats why peoples use to say "Learn PHP In 24 Hours" Not Javascript.
  • Javascript cannot be used to build a complete scraping script due to cross browser security restrictions, somewhere a server has to be used and that typically means PHP, Python or Java will be required.

    The only files javascript can read from another site are XML
    • [1] reply

    • .jQuery { just call()ed and said 'Can Too!' }
  • kcartlidge is right. PHP is your only bet of the two. You'll likely be using cURL, or something similar in PHP to pull the content from external sources.

    Since you are studying C++, PHP will come naturally to you (I was a C/C++ programmer before I was a web developer). PHP is very similar in syntax to C++.
  • agreed, you have to think about the two as PHP is serverside and JS is browserside. To build your scraper you will most def want to use PHP
  • Great place to know about if you're getting started with PHP
    W3Schools Online Web Tutorials
  • PHP would be the only choice in your case. As mentioned by several people. C++, C#, PHP, JavaScript, and Java are all C like languages that evolved with object oriented capabilities.

    Now if you're studying C++ you may want to consider using that language along with Qt which gives you all the necessary tools to access websites (QNetwork, QDom, etc.) To my point of view PHP does not offer the hardened C++ language checks that the compiler does (i.e. in PHP all variables are variants.)
  • read the first response twice and i had doubts if the guy is talking about the same javascript that i work on!!?? but as kcartlidge rightly put it javascript is any day easier than PHP,... higher end javascript yes more comprehension required, .... but then thats true for all languages.

    PHP is the choice if ur doing a scraper,... basically a server language, javascript runs on the browser.
  • If you're wanting to learn website design, then learn both PHP and Javascript.
  • Before you write a web scraping program, it is essential to understand the pattern of the data that you want to extract. You could use any programming language like Java, C#, PHP, PERL, etc. for this processing.
    • [1] reply
    • I agree with wordcatcher. And Java, PHP and PERL are interpretive and can be used on any computer where the software that contains the engine be that windows, linux, etc, a server or a client they are all capable of executing your source. You do not need apache or other http daemon to execute PHP, though it is the most used method.
  • mmm... i prefer php:

    i thought and this is what i know
    PHP have mail function
    js, dont have it.
    with php you can have the remote and local time
    with js you can have user time...
    with php you can have remote and host address
    with js ... i dont know !!
    with php the source is not lookable in the source code
    with js the source can be see in the source code of the page.

    That's all, may be i am wrong, but i dont know...
  • javascript is client side scripting language and php works on server,,,so you would need both,,,and in javascript use jquery ,,

    [mobile]
    tech
    {india}

Next Topics on Trending Feed

  • 17

    I'm in school right now learning C++ and other programming courses in my CIS classes. I"m also a fledgling internet marketer with a strong(focused) plan of attack. I've read many posts in this section of the forum on PHP but I have heard little about javascript. I'm thinking about coding a website scraper and want to use either php or javascript and I'm not sure which way to go. It seems like most people prefer php above and beyond other languages, but javascript doesn't seem to get much of a mention.