Download page using IE engine + use POST - c++

I need to make web-based API calls, using POST. This is very easily achievable via libcurl, but in my case - it is only working via IE API due to special requirements.
I found winapi function URLOpenStream which is working fine, but I did not found way, to use this function with POST data.
Is there are any way to do so? Or use other function, but it should be strictly IE API based.

You can try using WinINET's (wininet.dll) HttpOpenRequest function instead:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384233(v=vs.85).aspx
I'm not sure what version of C++ you are using but I found a code example here in CodeProject:
http://www.codeproject.com/Questions/816567/How-do-I-post-data-using-HttpSendRequest-to-a-loca

I've found "Msxml2.XMLHTTP.6.0" component, which suits me best, JFYI anyone, who will find this question :)

Related

SharePoint 2013: Consuming query (url) filter in custom webparts

I am building webparts and self hosted apps for sharepoint 2013, I want to consume the Query String filters that the user sets up, the process should be as simple as specified here on this microsft site.
Unfortunately I dont get the option to send values to 'my web part' but I do for other stock webparts that come with sharepoint. Which leads me to believe I need to implement IFilter or equivelent in my webpart, I have found information into IFilterConsumer interface and IFilterProvider interface on msdn which seems to be exactly what I need, however the documentation has one snag:
NOTE: This API is now obsolete.
So My question is, what is Microsofts new intended way of doing this with Sharepoint 2013.
Ultimately I need to read query variables in the HostWeb request inside my AppWeb code.
Edit: Apparently IWebPartParameters is the new interface for this.... trying to implement now.
I have also tried whats suggested here:
Passing parameters through sharepoint sitepage to web part Still not working, at the moment I have implemented IWebPartParameters, IWebPart, IWebPartRow and none of my functions that implement these interfaces are being called. I must be missing something in the manifest or features file maybe?
Thanks in advance
Crash
Ok the answer to this question is simple, firstly you can only do this in a dev environment with sharepoint installed, as you need access to the sharepoint.dll.
Then this thread answers the question http://www.manning-sandbox.com/thread.jspa?threadID=19791, with the following code solution which is here http://www.markitup.com/BookCodeSamples/TestingWebPartConnections.zip

GetWriterForMessage() not called in Monotouch - is there a workaround?

I have ported over some code from a Windows application to Monotouch.
It is using ASMX Web Services to talk to some API.
The code fails on Monotouch 5 because the method
System.Web.Services.Protocols.SoapHttpClientProtocol.GetWriterForMessage()
is never called.
I have seen that in Mono you will even get a NotImplementedExeption but not in Monotouch. It simply gets ignored.
I need to find a way around this. I have to add custom headers to make the solution work.
Any workarounds or maybe is there even a chance that this will be fixed soon?
(I also filed a bug report, but I'm asking here because I am desperately looking for a workaround).
EDIT:
I found kind of a workaround but it is very annoying to use.
In the auto generated reference file you will have to decorate each and every method with
[SoapHeader( "SessionKeyHeader", Direction = System.Web.Services.Protocols.SoapHeaderDirection.InOut )]
Then implement the custom soap header class but skip the GetXmlWriter() method.
A bug has been filed at Xamarin about this issue.

How do I open a Open File dialog in OS X using C++?

I'm working on an application using OpenGL and C++ that parses some structured input from a file and displays it graphically. I'd like to start an Open File dialog when the application loads to allow the user to choose the file they want to have displayed. I haven't been able to find what I need on the web. Is there a way to achieve this in C++? If so, how? Thank you in advance.
You have two choices, a quick one, and a good one:
Quick and pretty simple, use the Navigation Services framework from Carbon and NavCreateGetFileDialog(). You'll be done quick, and you'll have to learn almost nothing new, but your code won't run in 64-bit (which Apple is pushing everyone towards) and you'll have to link the Carbon framework. Navigation Services is officially removed in 64-bit, and is generally deprecated going forward (though I expect it to linger in 32-bit for quite a while).
A little more work the first time you do it (because you need to learn some Objective-C), but much more powerful and fully supported, wrap up NSOpenPanel in an Objective-C++ class and expose that to your C++. This is my Wrapping C++ pattern, just backwards. If you go this way and have trouble, drop a note and I'll try to speed up posting a blog entry on it.
To add to what Rob wrote:
Unfortunately, there's no simple equivalent to Windows's GetOpenFileName.
If you use Carbon: I don't really think NavCreatGetFileDialog is easy to use... you can use this code in the CarbonDev to see how to use it. The code there returns CFURLRef. To get the POSIX path, use CFURLGetFileSystemReprestnation.
That said, I recommend you to use Cocoa. Rob will write a blog post how to use NSOpenPanel from GLUT :)

Download File from Web C++ (with winsock?)

I need to download files/read strings from a specified url in C++. I've done some research with this, cURL seems to be the most popular method. Also, I've used it before in PHP. The problem with cURL is that the lib is huge, and my file has to be small. I think you can do it with winsock, but I can't find any simple examples. If you have a simple winsock example, a light cURL/Something else, or anything that could get the job done. I would greatly appreciated. Also, I need this to work with native C++.
I can repeat me answer Is it possible to handle proxies at socket level? (see also comments) about two important interfaces Windows Internet (WinINet) API and Windows HTTP Services (WinHTTP). An important restriction of WinINet is that WinINet should be not used in a service (only in GUI app.) because of possible dialogs.
you should try WinInet: this library is part of Windows operating system, and allows to download a resource identified by an URL, using either HTTP or FTP.
if you are using HTTP, you might find the InternetOpenUrl() function useful.

How to get form data from HTML page using c++

How do I get form data from HTML page using c++, as far as the basics of post and get?
EDIT: CGI is using apache 2 on windows, I got c++ configured and tested with with apache already.
The easiest way to access form data from an HTTP request is via CGI. This involves reading environment variables which is done using the getenv function.
First of all take a look at webtoolkit.
You might want to use that to make your life easier.
Second you can read about network protocols.
Third take a look at your webserver docs, they might provide such interface to create a deamon that will allow you to read the HTTP socket and the data that is sent over it.
On another note next time you write a question try to elaborate as much as possible.
Explain the use case and provide a test case.
You may use CgiCC library that gives you want you are looking for. You may also try some C++ web framework like CppCMS.