以下の PHP コードは、サーバー A からサーバー B に html を取得します。これは、ブラウザーの同一ドメイン ポリシーを回避するために行いました。(jQuery の JSONP を使用してこれを達成することもできますが、私はこの方法を好みます)
<?php
/*
This code goes inside the body tag of server-B.com.
Server-A.com then returns a set of form tags to be echoed in the body tag of Server-B
*/
$ch = curl_init();
$url = "http://server-A.com/form.php";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER,FALSE);
curl_exec($ch); // grab URL and pass it to the browser
curl_close($ch); // close cURL resource, and free up system resources
?>
Pythonでこれを達成するにはどうすればよいですか? PythonにもCurlの実装があると確信していますが、その方法はまだよくわかりません。