Filter content with cURL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Filter content with cURL

Post by sjuaq »

Hello,

I have a question about content filtering using cURL. Now that i can make get requests with cURL is it possible to make POST request and filter the page request?

viewtopic.php?f=1&t=144061

For example, a user visits my url and it will automatically login to a site and content filtering will remove the username, user control panel and the ability to make posts. Just giving access to read the site like a web proxy.

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Filter content with cURL

Post by requinix »

Yes, it's possible. You can make POST requests and the response is just a big string so you can do with it what you want.

But this idea of yours sounds hella sketchy.
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Re: Filter content with cURL

Post by sjuaq »

The idea is for a site that is blocked and i want to setup a php script in a web server using cURL to access it. The POST is a feature to the script to automate things. First i was thinking on modifying Glype but i got lost in the code.

Can you help me out on:
1) help docs for the POST request in cURL
2) setup a filter for the cURL string

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Filter content with cURL

Post by requinix »

Maybe. Why and how is it blocked?
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Re: Filter content with cURL

Post by sjuaq »

As you may already know i live in Portugal and there is some sites that are blocked by dns (for example TPB). I can change the dns to 8.8.8.8 and 8.8.4.4 but i have to do this in any device so i think that is better to just to take advantage of cURL (because i'm starting exploring it) and upload the file to a server.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Filter content with cURL

Post by requinix »

I don't think we can really help you circumvent legal blocking, even if I do disagree with it.

But I can tell you that cURL will resolve hostnames mostly according to system settings, and that the CURLOPT_RESOLVE option lets you give a custom IP address for a hostname.
sjuaq
Forum Commoner
Posts: 33
Joined: Thu Aug 10, 2017 4:48 pm

Re: Filter content with cURL

Post by sjuaq »

This is one example that i want to use the code for. I may expand to other projects when i fully understand how can i filter the cURL result string. Another project will be to login to a site with a different credentials and location since the IP provided to the end site is the server IP.

If possible provide with examples to work with. I have research on google and didn't found any workable solution.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Filter content with cURL

Post by requinix »

Thing is, the content filtering bit (rewriting the request to go through your servers instead of the remote servers) is difficult to do. Really difficult. Impossible, even, for stuff like Javascript. Frankly, this sort of thing is best done by actual proxies, even though that requires some client-side configuration since the browser has to know to use the proxy and to trust it with HTTPS content.

If you're developing this for the block then I can't tell you the really popular and versatile way to get around one that Google might know about.
Post Reply