How can I implement my PHP curl request to Python

AJ1804

New Member
This PHP code below fetches html from server A to server B. I did this to circumvent the same-domain policy of browsers. (jQuery's JSONP can also be used to achieve this but I prefer this method)\[code\]<?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?>\[/code\]How can I achieve this in Python? Im sure there is Curl implementation in Python too but I dont quite know how to do it yet.
 
Back
Top