Monitor http traffic going from localhost wordpress on Fiddler - php

I want to monitor all HTTP requests going to the internet from a locally deployed Wordpress instance (on XAMPP server) on Fiddler. I guess I may need to configure XAMPP (or php specifically) to route all the requests going from it to the internet via Fiddler proxy but I am not sure how to do that. Has someone done this before?
Flow:
1. Wordpress (on a local XAMPP instance) makes an ajax call to the internet via a plugin.
2. I want to check the HTTP request and response for debugging.
3. I configured Fiddler to monitor localhost traffic but that does not show me requests sent by XAMPP.
4. Stuck!

Related

"Connection Refused" via PHP cURL from GoDaddy Hosting to internally hosted Radarr server's API (jQuery works though?!)

I'm at a complete loss as to why this is failing, so get ready for the novel describing exactly what I'm trying to accomplish and what I've tested so far.
Goal:
I'm building a webpage on my GoDaddy hosting account that I want to connect to my locally hosted Radarr server's API via PHP cURL.
I want to use PHP so I can obfuscate the IP, port, and APIKey on the client side. Plus, some of Radarr's API calls I would like to use cannot be run via query string.
Problem:
No matter what I try, I am getting nothing but the following error:
Failed to connect to <MY PUBLIC IP ADDRESS> port <PORT NUMBER>: Connection refused
(And yes, this is the publicly opened port, not the internal port on the server.)
Setup:
I installed Radarr on a FreeNAS (11.3-U5) jail hosted in my home. This is working beautifully.
I setup the FreeNAS jail with a dedicated IP address instead of allowing it to NAT internally, just to make sure it doesn't cause any issues.
I configured port forwarding on my router to allow external traffic into the Radarr server. This is working. Note: Xfinity is my ISP, but I purchased the router separately.
I have a GoDaddy hosting account where I've written a webpage to tie into Radarr's API on my local network. Currently, the webpage is also working beautifully to query data from the API, BUT it's connecting to Radarr via $.getJSON with JavaScript and jQuery.
(Before anyone says it, yes, I know GoDaddy hosting isn't the best option, but it's the one I'm using.)
Testing:
I swear I've tested EVERYTHING and I don't know why this is failing.
This IS working through the JavaScript/jQuery solution, meaning the Radarr server is up and running, the port is properly forwarded through my router, and GoDaddy's hosting isn't blocking the connection.
I CAN access the raw JSON API response in the browser simply by entering the full API URL call.
And while I'd say I am versed in PHP, I'm certainly no expert, so I even tried pulling a generic PHP cURL script from another StackOverflow post, changing the URL to mine, and running that with no luck. Note: The original script DID work to connect to another external API though.
Then I tried Postman, which worked, and I used Postman to create a PHP script, but that script failed.
All of the functional testing done on my local network was done using my publicly facing IP address. However, just to be certain, I also tried reaching the API through the browser off my network, and that worked just fine.
In a desperate attempt, I also reached out to GoDaddy support to see if they had any ideas. They went as far as creating a test PHP cURL script in the same hosting directory and had it simply pull Google's homepage. That worked just fine.
After GoDaddy was unable to help, I setup a free hosting account and free subdomain on AwardSpace, uploaded the script, and that failed too.
In digging into the Connection Refused error, someone suggested just trying to ping the IP through PHP. I attempted this, but it returned 100% packet loss. Also, I logged into my router and watched the incoming connections as I tested. Using the jQuery solution, I saw the incoming connection and it worked great. Using the PHP solution, it didn't register anything inbound.
Lastly, I have confirmed that the publicly opened port on my router is in the list of blocked port by Xfinity. However, since I can access the server externally through the browser and via the jQuery script, that can't be the issue.
There seem to be many, many, many articles online about the general Connection Refused error, but I haven't found a solution to my problem from any of them.
Does anyone have any suggestions?

Send Request to a website in My PC local Host

I have a offline website installed on my localhost PC , I am using xampp with apache. I installed everything and I can access the website from browsers normally. But when I am trying to send any PHP POST or GET requests to this localhost from anywhere like PostMan or any other online website I got connection Refused Error. Also its happen with file_get_contents.
I don't have much experience in Windows firewall or apache configuration so I need advice for what can I do?
it was a CSF firewall error from the online server side. it was not allow me to send the requests outside the server without whitelisted the requested server :)
Thanks

AWS EC2 server refusing Ionic/Capacitor/Android connections to PHP files

I have recently begun building an Angular Ionic app which connects to PHP scripts on an AWS EC2 server. Everything works fine except for when I try to connect through Android once the app is built on my phone.
The response is a simple 404 response with no additional information. When I look at the log on Android Studio I see the following response:
E/Capacitor: Unable to open asset URL: [api address]
I have reduced both the HttpClient call on the frontend and the php file on the backend to their most simple forms and yet still nothing:
<?php
echo "Hello";
?>
I know that Capacitor was updated to 3 only a couple of months ago and am concerned that it is related to that. I am using PHP 7.
UPDATE
The issue was indeed cleartext but the issue was made more complicated by the fact that HttpClient was not catching the error and so I was simply getting back an unknown failed response.
In order to first see that it was cleartext I first had to change HttpClient for the Native HTTP plugin and check the logs whilst testing on my phone (HTTP will not work through the browser).
Only then did I notice that I hadn't changed the config file correctly.
As long as your PHP web server is not running on the Android device directly trying to connect to localhost / 127.0.0.1 won't work and you need to use another domain / IP your web server is available on and which the Android device can access. You can also check this by simply opening the URL in the browser of the Android device.
If that is not feasible for you you could also use port forwarding via adb to forward a port of your web server to a local port on the Android device.
If you use another domain / IP make sure your web server is not listening to local connections only and is not blocked by a firewall or similar.
Also if you are using an unencrypted connection (i.e. http instead of https) you might need to enable the cleartext config option in you Capacitor config.

HTTP_Request call works in browser, timeout in web app

I have a web application which gets data from itself via a REST API in JSON format. I am in the process of moving this site to a new server on a new host. I have everything moved, same database, same files. The main differences would be that PHP is running as a module on the new server instead of FastCGI and the new host has a client-configurable-firewall.
The web app makes the API call by using Pear's HTTP_Request object (GET method). When I run the web app that makes the call, it spins until it finally returns a "Connection timed out" error.
However, if I echo the URL being used by the call and then hit that directly in my browser it returns all the JSON data instantly.
I am wondering if this could be a firewall issue: port or protocol used by the guts of Pear's HTTP_Request object blocked? (There is currently a firewall policy allowing traffic on port 80 from any IP).
Or a permission issue: PHP running as a module is more sensitive to this.
Any ideas would be greatly appreciated!
As the new server is still only being tested using the IP address, the internal web application was attempting to access itself via an external IP. From the server itself, the external IP is not available. It has to be changed to point to the internal network IP for testing.
Once the domain name is moved this will become a non-issue again.

Trying to use post to a virtual machine server that runs a codeigniter project

I am running a virtual machine on my computer (debian 6.0.2.1) that runs an apache+php+mysql server. On my local machine I have a WAMP stack instaled. On both machines I have CodeIgniter deployed and running a RESTful API.
What I am trying to do is to communicate with my virtual machine from the local machine's application. The virtual machine's application accepts post & get methods for an end-point.
e.g. http:///thumbs/save/ it should return a message. If I test it in the browser for the get method, it runs fine. The problem is when I try to access it from the other application (local machine deploy) with a jquery post/get I get the following:
for chrome as usual: XMLHttpRequest cannot load http:///api/thumbs/save. Origin "http://localhost" is not allowed by Access-Control-Allow-Origin.
and firefox just throws a 200 with status OK but it shows up red and with no response.
A little help would be appreciated. Tell me if you need code examples.
Thanks.
The reason you are seeing that error, Access-Control-Allow-Origin, is to prevent a security issue known as XSS (Cross Site Scripting). Your one domain is localhost, and the other is API.
Take a look at this question/answer for some ways around it. No code examples, so not sure what methods/access types you are using: Access-Control-Allow-Origin error sending a jQuery Post to Google API's

Categories