I'm learning socket programming using C++ , so as a project I thought of a software that downloads all image search results for a certain search(eg."cats"),
I'm using WinHttp and the exemple in here
and giving it :
the server name L"www.google.com"
object L"/search?q=cats&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiP9M3gtZTPAhXLKMAKHYSyDqIQ_AUICCgB&biw=1152&bih=634#q=cats&tbm=isch&tbs=isz:l "
The problem is that the HTML file in the response message contains what it seems to be an "Outdated" file That doesn't contain links to the real images, here it is (I can't give you the whole html file it's too long but here is an image
Research:
I first thought it was a user-agent problem so I added user-agent header, but it didn't work.
The Problem:
I want to get the same HTML result that I get when I search my browser for the same object
I found the problem it was the user-agent , just copied the user-agent from my browser
Related
I am working on an offline web browser that open content from archive files.
I use the QWebEngineView class to display the content and it works for most of the files I use.
But I have the case where there are links whose relative url contains "../" at the beginning and Qt doesn't seem to correctly interpret this type of path.
For example on the page which url is "question/8/turing-completeness-in-conlangs.html", there is a link like this and it redirects to "question/tag/grammar/1.html".
Is this behaviour normal ? Is there anywhere I can modify it ?
I already tried to fix this problem in the QWebEngineUrlSchemeHandler::requestStarted method but the url of QWebEngineUrlRequestJob *request is already wrong
I'm having trouble in adding a seek feature to my music player.The problem occurs for the google chrome while other browsers(Microsoft Edge,firefox,etc) works fine.The problem can be seen here in detail -> HTML audio can't set currentTime
I'm guessing that the issue is in the HttpResponse Header 'Accept-Ranges' which is not present in the Header data.This is suggested in answers present in the link I provided above.
I'm new to Django programming so I don't have any idea about how to tweak with the Http header.From my reading, I was able to change header of my views but since the media is served(handled) by django, I don't know how to send http header in its response.So It would be great if told how to do it.
Why does this function work on a direct url to a download however fail on a php page echoing out a file for download? (GetLastError is 0)
Not all HTTP requests will have a content length field in the response. Dynamic pages generated by PHP scripts might not know how large the content actually is.
In these cases you need just need to read a little bit at the time until there is no more data returned from the server.
My problem seems similar to Not able to visualize a loaded data , but I have no console errors and I have already added the '-allow-file-access-from-files' flag to my Chrome Browser. Here's my Java coding,
window.onload = function() {
var r = new X.renderer3D();
r.init();
pros = new X.mesh();
pros.file = 'file:///C:/Users/Nathan/Downloads/JB Farmer STL ACII.stl';
pros.caption = 'Prosthetic';
r.add(pros);
r.render();
};
Should I "play around" with with camera position, I know I have to do that in Three.js.
Maybe the model needs normals? I'm not sure if it does or not. I haven't worked with 3D modeling, besides Three.js.
Update: Ummmm, I'm not sure what is going on with this, but I realized that XTK generated 2 canvases . I looked at the first two Lessons and they have one.
^ Now eliminated the extra canvas, must have copied a piece and that was in there.
For the moment, the loader of xtk doesn't seem to be done for local. I mean : it uses an XMLHttpRequest (XHR) to get the file with a GET request. First of all the request must be sent to something that can handle it (a server or localhost emilated by Wamp or equivalent). Then let's imagine if one broswer, no matter what one, allows XHR on a file at client side by his url, and imagine I'm a pirate and you come on my website. I know Windows well, I know in C:/Windows/System32 there always is a file where I can find your personals data. What do I do ? An XHR ! You've been hacked. It's a story but you see the idea.
That's why the only ways allowed by browsers to access local files are HTML5 File API & HTML5 Drag&Drop API (unfortunately...). Actualy a way to go through that limitation is having binary code at the client side (flash, java applet). The client is the only one who can ask to open a file or drop a file, so the browser is sure there won't be any security failure because of him.
So you should test it with something like Wamp and access your file with an url like "http://localhost/.../myfile.stl" or the relative url "/.../myfile.stl", or do the following if you realy want local files.
A few weeks ago I wrote my own parser for a private format for xtk and from local file, it worked well, I just used HTML5 APIs to read the file and get a String or BinaryArray from it and then wrote a parser that transformed it in a X.mesh. So I think the best would be to extend the X.loader for HTML5 file APIs, or like me to manualy load the file.
The following jsFiddle from Haehn helps : here !
What happens if you modify the filename with no space?
JB Farmer_STL_ACII.stl instead of JB Farmer STL ACII.stl
i am trying to find out, how to get input from html inputs using c++. In windows you can send WM_GETTEXT to the window and it returns text, that you wanted. But is there any way to do the same thing in web interface?.
I am not interesting in sniffing packets now.
For example. Some site has html intput which expects name. I write name to the input. And then i want to catch it with my program
If I understood correctly what you want to do, you have to set up a web server that calls your C++ application via CGI. So, you'll have an HTML page (static or generated by your program) that will contain a form, that refers to the URL of your application. So, when the user will click Submit, the browser will issue a request to the webserver, which in turn will call your application, passing to it the various POST/GET parameters related to the form.
Your application then can process the data, extracting such parameters from the environment variables (if the data is passed using the GET method) or from the standard input (if the POST method is used). To generate the output page (along with the output HTTP header) you'll simply have to write it to the standard output.
One thing I can think of (if you're using Linux) is using wget via system() from within your C++ app.
Wget to fetch the html page and output it to a file, parse the file for the URL of the form and data that it needs, pass the response as POST / GET via wget and so on.
That is, if I understood what you meant by "do it from existing page" correctly.