While developing apps that use external web services, a proxy often comes in handy in order to bypass the pesky XSS security settings found in most browsers. Here is a simple PHP proxy I’ve found quite helpful.
// http://benalman.com/projects/php-simple-proxy/ $url = "http://mcaf.ee/api/shorten"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_FORBID_REUSE, true); curl_setopt($ch, CURLOPT_MAXCONNECTS, 16); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_REQUEST)); $result = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); $type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); curl_close($ch); if(!is_null($type)) $type = 'text/html'; header('Content-Type: '.$type); switch($status) { case 500: header("HTTP/1.1 500 Internal Server Error"); header("Cache-Control: no-cache"); break; case 200: default: header("HTTP/1.1 200 OK"); break; } echo $result;
Hi, I do think this is an excellent website. I stumbledupon it 😉 I am going to revisit yet again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to guide others.
Pingback: tunneltube