Media Wiki JSON response - json

I am little bit new in media wiki and now I am developing a extension. I would like to print a JSON response when it’s makes a request for one of my special pages, that the extension creates. The JSON response is not a content of Wikipedia page, it’s a public key that I want to print, and only that. I find for solutions but I don’t find nothing. What it’s the best way to print that? API, Jquery, Special pages?

The API. See API:Extensions for instructions.

Related

How do I retrieve text and images from websites (in HTML or JSON) on iOS Swift?

I looked around the Internet to figure out how to get data from websites using SWIFT, and have narrowed it down to roughly JSON or HTML, which I am not familiar with.
As far as I know, there are third party libraries for me to use to parse the data. I have been following Dani Arnaout’s Working with JSON in Swift Tutorial as a reference. However, I have not been able to find the way to retrieve the JSON from any random website. Only the iTunes JSON page, which is included in the tutorial, works.
What I want to do: Make an app that downloads images and also some text from many different websites, either by HTML or JSON. The problem right now is that I have no idea how to start doing it. A simple demo would be helpful.
Questions
How do I get the JSON of any random website on the Internet?
How do I make use of the HTML data from websites to turn it into a readable format? I’m retrieving the HTML using Google Chrome, and it seems to be gibberish: I can’t find the text anywhere.
Question 1: Not all websites expose their content formatted as JSON.
Question 2: I think you should look at a couple of resources. First Ray Wenderlich has a tutorial on how to parse HTML. Although it is using Objective-C you should be able to learn quite a lot there.
When you have read that tutorial I would recommend you look at the Swift library Alamofire. There is another tutorial on the Wenderlich site covering this library.
Happy coding!

How to parse a PDF using AS3? (air)

is there a way to parse a pdf using AS3 via Air in mobile?.
I don't need the full content of the PDF, only some data, is that possible?.
Edit for clarification:
I got a PDF file that was originally created based on a XML, what I'd need is to be able to retrieve that XML. Or at least, to find a string inside that PDF so I can make a call to a web service.
Original:
There's nothing native in AS3 for this kind of stuff but AlivePDF. It won't let you traverse things like XML so much, as it seems like you're trying to do by taking a small bit of a PDF, but it will let you create pdf's, add pages and change fonts etc.
You weren't entirely clear on what you're attempting to achieve, if you update your question a with a bit more detail we may be able to help a bit more.
Edit:
From the refined question, AlivePDF is not what you're after as it's really only for PDF generation. I'm assuming you're after a method to traverse the document like you would XML, by looking for a tag and extracting the information. I've not found a way to do this other than iterating through the document and searching manually which probably isn't what you're after.
After some searching I found an as3-pdfreader which doesn't seem to be complete at the moment. However on the Project Home the roadmap says parsing pdf files is complete, I've not been able to try it out yet though.

SaaS CMS API possible and/or useful?

Everything is increasingly distributed. Outsource your authentication with Facebook or OpenID, comments with Disqus, file uploading with filepicker.io and storage with AWS. Perhaps in the future websites will merely be interfaces that link all these services together in a meaningful way to the user. Another part of a website that might be outsourced is the content. Imagine retrieving JSON with page content, menu structures and lists of blog posts. The content would be edited on a different website than your own.
A problem a CMS like this might face is the automatic creation of pages. Requiring clients to install a htaccess file could be an option. Maybe clients only want to allow automatic loading of pages on specific subredectories like domain.com/blog. Probably the routing should be left entirely to the client, and the API could be invoked on their content-page.php
I think it should be very minimal and not enforce use of certain template engines upon clients. It should just load the HTML of the content.
I'm not sure if this would be useful, considering that you might want your CMS to also handle routing to content pages, and I don't think that could be done through an API but please correct me if you see a way.
My question is: would you use something like this? Do you foresee any problems that I'm not seeing? Any suggestions?
To illustrate more clearly what I mean, here's an example content-page.php of a client:
$cms = new SaaSCMS($apiKey);
$content = $cms->getContent($_GET['page']);
if ($content)
{
// Display content
}
else
{
// 404
}
Not sure, but it reminds very nicely of Jekyll, which achieves most of the goals you stated above

Converting Webpage to PDF

I have a project and the old programmer thought converting a webpage to PDF would be easy using web-based conversion software. I'm not so sure since it requires headers/footers and it's a listings page, so it will need to know when to & when not to page break, or else it will start new pages halfway through an item on the list. I've also had problems with it cutting up images between two pages.
I've tried convincing the client that the requirements are too much and we need to create the PDF using PHP, but they are convinced building a page in HTML and converting it will work.
So I want to know if there are any web-based conversion software out there that supports converting HTML, with headers / footers and ability to tell it when to and not to page break.
Thanks.
There's plenty of Saas services out there. Here's another Saas one I highly recommend.
It's htm2pdf.co.uk and they have both a PDF API (that works with http GET and supports all platforms) as well as a HTML to PDF SDK (that works with http POST and is only available in PHP).
It is based on webkit and therefore supports anything webkit does. Webkit is what browsers like Safari & Chrome are based on. It supports headers / footers / page breaking and what not, but also additional PDF features like encryption and watermarking.
I work at Expected Behavior, and we have a product called DocRaptor that converts HTML code to PDF with an HTTP POST request. DocRaptor can definitely handle headers, footers and page breaks. DocRaptor is a SaaS application, and every plan has a 30-day trial.
Here's a link to DocRaptor's home page:
DocRaptor
And a link to our coding examples:
DocRaptor coding examples

How to upload a file to a website using HTML

I'm developing a website and I'd like the users be able to upload files to the server using a webpage.
The server side is .NET, but it's not ASP.NET. That means, I'm generating the html code myself instead using ASP.NET, and I'm working with the GET string and POST stream directly. It's a good exercise to learn what happens under the hood :D, specially nowadays when there is a framework for everything.
I've been trying to find information about this, but I found several approaches, some of them javascript (thing I want to avoid for the time being) and lots of premade controls. What I want is to do it myself, I don't care if there is a nice, nifty and well-proven ASP.NET control... what I want is understand how it do that with all its implications.
Cheers!
In the HTML you need a form with an input of type="file" and the enctype attribute of the form set to "multipart/form-data" rather than the default of "application/x-www-form-urlencoded".
Multipart/form-data is defined in RFC 2388, and will behave differently to the application/x-www-form-urlencoded you've been parsing with this experiment so far, though it's quite straight-forward. The RFC should give you all you need to know to replicate how the HttpRequest.Files property works in ASP.NET.
An extension of this, try sending streams from XMLHttpRequest in a page or HttpWebRequest in a .NET client application, using both POST and PUT (you may have to change IIS settings to allow the PUT through), as this the overlap of working on that along with your experiments here will cover some knowledge that has some real applicability even when you are using all the toolkits. Another extension is to try implementing both sides of both schemes in RFC2617 without any help from the framework (sometimes the server side of this is genuinely useful).
Kudos for experimenting with this, it should bring real experience to back up what you can learn from reading RFC 2616 (though that's still absolutely vital for anyone doing web stuff to be intimiately familiar with, as reading will cover some cases your experiments don't touch on, and explain anything that seems strange in your results).
I think this should have what you need.
Basically you need an <input type="file"> and to set the encoding of your form to multipart/form-data.
<input type="file" name="somename" size="n">
You put that in a form, and hasta la vista baby !
You can't do a file upload using pure HTML: You will need to handle the uploaded files on server side.
You could parse the uploaded file(s) out of the raw POST data if you want to learn how it works "under the hood" (see here for an example how to do it in ASP), but you will need some kind of server side language to do it.