Fetch a list of GET Requests from a website - web-scraping

Is there a way to get a list of all the GET Requests an external Website sends? When I load a website and open the developer tools -> network -> XHR thats the list I want. But I want to get it via PHP or JS - is that possible ?

Related

Where to put x api key while fetching from server

I am trying hit following link Actual link from requests and python, since it is Javascript I dont want to use selenium for automation.
I know it uses api in backend, However I am not sure where to put key in url it has x-api-key for following url , I tried using ?x_api_key='key' in request header still not working
Api Link

How to fetch a web page from a web site with URL using the web browser?

I have an assignment that reads "You want to use your web browser to fetch a web page from a site called "www.wagstaff.info". Its web server is at TCP port 8080, and the page you are looking for is called "horse.html".Give the URL that you enter into the navigation field of your web browser."
My first thought is that I want to write "www.wagstaff.info/" and then somehow query the web server for the object and retrieve it if it finds it, but i'm not sure if this is the right approach / how to do this.
I actually entered this site and I think the port is miswritten and it should be 80. I tried making a TCP connection to this site with port 80 and it works. I made a GET request for /horse.html and I got 404 Not Found, which makes me believe the page /horse.html doesn't exist on this site in actuality, but it doesn't have to, the assignment just uses the site as an example. But how would I make such a query/request not in cmd using telnet, but instead using the web browser and entering a URL?
If i'm on the correct path here, then, in other words, what do I type after "www.wagstaff.info/" to query for an object (or page) "/horse.html"? I would expect to get a 404 not found in my web browser, but to me it would mean I have a correct solution.
i would write the following: www.wagstaff.info:8080/horse.html
the www.wagstaff.info is the domain name that is then resolved to an actual ip address (like 192.168.0.1) what comes after the colon would be the port you're attempting to connect to and everything after that would be the path to the file you're trying to fetch.

Can't view GET request to remote API in Chrome

I have set up a section on my Drupal 7 site to show press releases that are fetched from a remote service through a REST API. It works fine to fetch and show all press items via a very specific POST request.
But I have no luck when I want to fetch just one specific press item, which according to the API docs shall be done with a GET request.
In order to see what happens I want to view the GET request to the remote URL in Chrome, but I can't figure out how.
This is how I do it: when opening the page where I want to show only one full press item:
On my press item page...
https://examplesite.com/newsroom/pressrelease
... I have a custom block where this code is run:
$item_id = (int)$_GET['item_id'];
// Fetch specific pressRelease from remote API with custom token
$headers = array('Custom-Token'=>'[custom-token]', 'Accept'=>'text/json', 'Content-Type'=>'text/json');
$url = "https://[remote newsroom url/]$item_id";
dpm($url);
$options=array(
'method'=>'GET',
'headers'=>$headers
);
$result=drupal_http_request($url, $options);
dpm($result);
$data = json_decode($result->data, true);
dpm($data);
With my dpm statements I can see the request on the page, but I would really like to see the actual request and response in Chrome dev tools (under the Network tab). But there is nothing to be found. I have tried using extensions like Live HTTP Headers, with no luck. Only the request to view the local page is shown not the remote one.
How can I see the http request to the remote URL in Chrome or Firefox?
EDITED... the problem might be that the request is done while the page is generated on the server side, before it is loaded on my site?
The code that you are executing, lies on the server and cannot be viewed from network tools of the browser, The browser developer tools will be able to track only those request that are made directly from your browser, in the form of AJAX request etc.
In order to view the actual request, you need to use a network proxy like Charles or Fiddler on your server which will track all HTTP network traffic from your server.

Where can I find sample Web Server Requests/Response Data

Is there any sort of data dump or data set with information from Web Server logs?
The information that I am mainly looking for are:
a) what type of request is it (POST or GET or HTTP or something else)
b) What type of data is being transferred (image, audio, video or text)
c) what is the size of the data that is being transferred
Information such as IP address, URL can be anonymous.
Are you using Firefox? If so, you can use the included Web Console tool to view all the HTTP request body being sent from your browser to the server and the response bodies, along with things like the method (GET, POST, etc.). This would be the same thing that a web server would be logging (except the IP address of the client is always you, obviously). You should be able to copy all the data and paste it to a file if you want a data dump.
To use the web console, click the orange Firefox button and then Web Developer > Web Console. Or if you're using an older version or have the Firefox button disabled, it's under the tools menu.
Edit: To get the most out of it, you'll want to right click on the console and select Log Request and Response Bodies. This will get you more information than just the headers.

web page http post check tools

im tasked to secure a web project. and the codes are messy. basically i need to focus on webpages that are using http GET and do proper validation or convert to http POST.
is there a free tool out there that runs on linux which search and generate a report?
A report of what http get requets are made by a web application?
Well, what about a simple network sniffer, like tcpdump or wireshark? lists you every request made. And you can process the dump using plain cli processing tools like grep and sed.
There is no tool in my knowledge which will generate a report like that.What you can do this , intercept the get & post requests using the tool called Fiddler ( windows only ) , It will list all the request & response which goes IN & OUT of a browser.
Install fiddler, start it.
Access the application
Go through the application and check the Fiddler interface.
It will list all the GET & POST data
You can generate report by examining this data.

Resources