I need to forward CURL
requests on the fly that is written in php. a php
program send request to: XYZ.COM
is there any way to forward
its request
to another location ?
can i use .htaccess
?
please let me know if there is any solution.
php script is encoded & we dont have access to its source code. script is web based.
What you are trying to do is forward request based on User-Agent . Since that header can be set freely, there is no way you can 100% assure that you are getting all request coming from a curl client.
Imagine this cURL
command execution
curl --user-agent "freetext" http://www.example.com
If you are sending the request yourself you could do
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
curl_setopt($ch, CURLOPT_USERAGENT, "myagent");
// ...
// all the other parameters needed
// taken from http://www.php.net/manual/de/book.curl.php
the Apache RewriteRule would look like this
RewriteCond %{HTTP_USER_AGENT} ^myagent$
RewriteRule ^(.*)$ https://www.example.com/curl/$1 [L,302]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.