January 19th, 2017, 04:42 PM
How To Code In Php 7 To NAVIGATE, WAIT FOR ITEM ELEMENTS, TYPE CONSTANT, CLICK BUTTON
Fellow Php Developers,
Googled but no luck to get Php 7 sample snippets for my learning purpose.
Can you be kind enough to give me code snippets in Php 7 so I can learn Php 7 faster while gaining work experience building scripts ?
I have tailored (but not built) a script with a variety of functions. If I can get the source code of the script (build it or get it built) then I can learn many functions from it. Good work experience! The task of the script is to auto search keywords on google. Here are the steps the script must undergo:
* -> NAVIGATE TO (CONSTANT): google.com
* -> WAIT FOR SEARCH BOX HTML ATTRIBUTE TO LOAD ON PAGE
* -> WAIT FOR SEARCH BUTTON HTML ATTRIBUTE TO LOAD ON PAGE
* -> TYPE KEYWORDS (CONSTANT): "php 7 programming forums" ON SEARCH BOX
* -> CLICK SEARCH BUTTON
(LOOP WHILE NOT LIST ITEMS IN LIST "SEARCH RESULT" = 100
* -> WAIT FOR SERP LINKS TO LOAD ON PAGE
* -> SCRAPE ALL SERP LINKS (fullhrefs) TO LIST: SEARCH RESULT
* -> CLICK NEXT BUTTON
END OF PSEUDOCODE
As you can see, The PSEUDOCODE has about 10 functions and so just glancing over the script should give me work experience in 10 things (teach me 10 different codes).
So basically, hen you load the auto-search.php, it should redirect you to google.com, keyword search for "php 7 programming forums" and scrape all links presented by the search (page after page until 100 links have been scraped).
Show me different code samples so I can learn a variety of ways to achieve the same goal.
Anyway, using that PSEUDOCODE I built a .exe tool (Ubot Studio). Now, I want to learn how to build a web version. The first 10 people who provide codes here where their codes do all the steps mentioned in the PSEUDOCODE will get a free copy of the .exe version as a thank you and so NO you won't be wasting your time helping me learn Php 7 through practical work experience as you'll get something in return! And don't forget other newbies would benefit from your code contributions too and LIKE your posts!
January 19th, 2017, 09:33 PM
Not going to write it for you (wheres the learning in that??) but you should look at some of the CURL functions for getting the data, and then the dom functions for parsing it.
Just remember that PHP is server-side, and doesn't have any sort of gui functionality. That means that you can't see what's happening in the background, you can't see when an element is loaded, and all that you'll see is a list of URL's that are output along with any other messages that you want to output for yourself.
PHP: cURL - Manual
PHP: DOMDocument - Manual
Comments on this post
January 20th, 2017, 07:55 PM
Wow, I need to expand my resume, then...
Fwiw, Google has a limit on things like this.
With that said, Google has fairly good documentation.
No thank you. I can build my own software. All while my labor is not being exploited.
January 21st, 2017, 04:28 AM
Ooh, yeah, bots are no good. Especially not when the thing you're trying to bot has more legitimate methods available.
oakleaf pointed out the custom search documentation. That's what you need to use.
Meanwhile questions about PHP that help you learn are fine. Like "how do I use this API" or "what does this code do". But they'll have to go in new threads.