Create RSS feed from webpage/ Display changes from external webpage - php

I am Creating a web application that will get homework from schools website.
I have been creating rss feeds for the website using dapper Creating an rss feed converting that into html and then putting that into an Iframe on my website.
I think there has to be a better way to do this.
I don't care what language this would be done in but i would prefer to do it client-side with php or javascript.
I'm intermidiete level php and not so good at java script.
If you could provide detailed explanation with some code that would be great.
also I have legal permission from my school which will be the first for this to go live to get the homework.

I'm assuming you are about create an php application to retrieve the rss from external site (which already have a specific url). Well, i think its better to build a public API first at the source app/external site, to get more multimedia support.
But if you're have no problem with parsing an xml format into html directly, then you can use cURL instead iFrame(or if you didnt have cURL installed in your php, you can modify lil bit and use my Proxy Library,a PHP class which enables you to make call to internal and external site with general HTTP request by opening a socket connection to the remote host, originally writen as Codeigniter Library.)
That way, it will be easier to presenting a html view/page rather than proccess it via iFrame.

Related

Office 365 SharePoint site accessing data from external MySQL and/or PHP server

I can't seem to find any other info on this topic anywhere on the interwebz.
SharePoint 365 seems so powerful, looks like an awesome solution for a whole bunch of business IT requirements.
But everything is in ASP and XML, but all my data is inside an external MySQL server, accessible through PHP pages which process and spit out JSON objects. This has worked nice and tidy for all my other apps so far.
How can I get my SharePoint site (which is basically HTML CSS and JavaScript, right?) to hit my PHP server (with HTTP GET or POST) to access my JSON data (and then process and display it however I like)?
I know AJAX can't hit external servers, so on my SharePoint site I'd need something equivalent to cURL perhaps... but with the functionality of AJAX?
Another possibility I'd avoid would be to create some kind of middle-man page/file/app in SharePoint which can process the data locally via AJAX, and send/receive data to/from the external PHP server. But this would all be in C# or ASP, ughhh surely there's an easier way?
EDIT :
Came across this post regarding XML content, the best answer was to "create a custom .NET assembly" to parse the XML... I can't believe SharePoint with all its awesomeness wouldn't be able to handle external JSON content??
You are right that SharePoint at it's heart is just ASP.net engine rendering HTML, JS and CSS down to the browser. For SP to access your data, you would need to expose the MySQL data via a REST service. This could be written in any language since it is a service. It does not need to be C#, .net or ASP as all SP is doing is calling your endpoint and receiving the json data. So no reason you could not use PHP for this.
Once you have the service, you can create a javascript file to call it using jQuery and the $.ajax() or getJSON() method to get the data. You render the data onto the SharePoint page by adding the Script Webpart in the proper location. Once added, click the Edit Snippet link on the script webpart and insert html with a reference to script file and a div to write the results. There are many examples of how to do this type of request and parse the data on the web as it is not something specific to SharePoint. Place the javascript file in the SharePoint site. I typically put it in a custom folder in the _catalogs/masterpage library.
If you just need to display this external data on one page along side your SP data, like in a dashboard, this solution will work. If the external data needs to interact with the SP data or you need to place it in multiple locations, then you may want to look into building a SharePoint App and you can use PHP to do this. Here is a link to a sample project on GitHub. https://github.com/OfficeDev/PHP-App-for-SharePoint

iso - Loading a local php file UIWebView and adding information

I have a properly coded HTML page that I can display in my app.
The file is embedded locally inside the app, but it pulls in data from an API.
It is a Rest API that works with PHP.
So my question now is - is it possible to have NSString inject it's value into the php file so that it can display the required result, or are PHP and Objective-c not designed to do that??
If you are looking to actually parse and execute PHP in your iOS app, I am afraid you are probably out of luck.
If you simply want to dynamically update certain elements on a static HTML page and leverage a PHP service to do it, your best bet is probably to use javascript and AJAX to put the dynamic content from the service.
Alternatively, you can treat the HTML file like a template, make a call to the PHP service to get the dynamic content; merge that content into the template and display the template.
I guess what is most appropriate in your case, will ultimately depend on your desired user experience.

Capturing image generated dynamically when scraping a page

I'm trying to capture some images from an old database.
When writing scrapers, I use ruby (but am comfortable with php as well) to directly open() a website and read its contents. I sometimes also use the script to call the appropriate curl ... command.
However, the database I'm scraping some pieces out of returns a page and then embeds the target image with an image name using a series of random numbers I assume by the server side script. For example:
<img ... show_image.jsp?343523.jpg
However, I cannot call this show_image script directly (denied), it only works when embedded in the website as a whole.
Can I use curl, or within ruby or php do something download the entire page, for example, 1929.2.14.aspx in such a way that it includes the embedded image generated by show_image.jsp?343523.jpg?
If I simply curl the aspx file directly, I naturally just get the html - how might one save both the html and embedded image via scripting in the manner that a browser-based "web archive" feature works manually?
Any tips, links to tutorials, etc. appreciated...
You should probably be using mechanize to scrape websites in ruby. When you do it will set cookies and referer for you so getting the image will be as easy as:
agent.get(image_url).save_as 'local_filename.jpg'
If the script (show_image.jsp - for example) is doing a simple referrer check, you may be able to work around it by writing your PHP (or Ruby) scraper in such a way so as to set the referrer before making the GET:
curl --referer http://www.example.com http://www.example.com/show_image.jsp?bar.jpg

Scrape web site generated by Javascript

I think this is a real challenging one!
I write a website for my local football league, www.rdyfl.co.uk , and include javascript code snippets from the F.A's Full-Time system where we generate our fixtures, linking in tables fixtures recent results etc.
For another feature I want to add to the site I need to scrape the 'Upcoming Fixtures' for each agegroup and division but when I examine the source I have two problems.
The fixtures content is generated by javascript and therefore I need to see the generated source and not just the source.
When I view the generated source using Firefox the team names are actually further javascript links and not the name itself.
I basically want to somehow download the fixtures on a regular basis and write then to a mysql database ?
I have asked the F.A. and they have no more options available to access the data ?
Having never coded for scraping before can anyone point me to a simple solution or does anyone fancy the challange?
This question was asked a long time ago, but I noticed it was active today 🤷.
You should be able to scrape the website using a headless browser such as Puppeteer. Using Puppeteer you are able to access a URL and execute JavaScript or interact with the website as you would with an ordinary browser. Parsing the output DOM and storing it should then be relatively straightforward.
There are plenty of articles on this topic using Puppeteer.
The latest version of OutWit Hub is doing a pretty good job on dynamic content. The source scraped by outwit to extract links, images, documents and tables and text is the updated DOM. You can certainly make a job to grab what you need using these.
Custom scrapers are still applied to the static source in version 1.0.3 but version 1.1.x (still in beta) will offers the choice between the static source and the dynamically modified DOM.
Scrapping content produced by Javascript is challenging. AFAIK you will need to do this with AJAX. Hopefully the content has some css that you can grab with jQuery or at least some id's. Do you have id's or classes that you can grab?

Integrate Yahoo Pipes into PHP App?

I just found this pipe.
http://pipes.yahoo.com/jonbishop/8vA1gjvl3RGqWknCBB50VA
I was just wondering if it was possible to integrate this into my web app? How would I go about doing it.
Basically, I have a form on my website - I would like this form to interact with this pipe to get the relevant data.
Could someone post a summary of what I would need to do to achieve this? I can then probably work it out from there. Using PHP.
Thanks
Quoting http://pipes.yahoo.com/pipes/docs?doc=overview
Sharing a Pipe
Once you've built a Pipe, you'll be
able save it on our server and then
call it like you would any other feed.
Pipes offers output in RSS 2.0, RSS
1.0 (RDF), JSON and Atom formats for maximum flexibility. You can also
choose to publish your Pipe and share
it with the world, allowing other
users to clone it, add their own
improvements, or use it as a
subcomponent in their own creations.
So you'd access it with any Feed Reader or XML lib you like. I am not aware of a public API for building Yahoo Pipes programmatically.

Categories