smazharzaidi Posted May 23, 2011 Share Posted May 23, 2011 how to pass data on other domain in PHp or curl ?? and also how to get data on other domain ?? if anyone knows how to do it plz attach code Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/ Share on other sites More sharing options...
shamuraq Posted May 23, 2011 Share Posted May 23, 2011 can u describe the scenario in better detail? Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/#findComment-1218967 Share on other sites More sharing options...
anupamsaha Posted May 23, 2011 Share Posted May 23, 2011 You should research and code by yourself. If you have any issues, post it here. See these links: http://php.net/manual/en/ref.curl.php http://php.net/manual/en/curl.examples.php Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/#findComment-1218969 Share on other sites More sharing options...
JustinK101 Posted May 23, 2011 Share Posted May 23, 2011 Here is CURL wrapper class we wrote. Enjoy. <?php /** * Curl * * @todo * * @version 1.0.2 * @date last modified 05/20/2011 * @author XXXX <http://www.XXXX.com> <hello@XXXX.com> * @copyright (c) 2011 XXXX. All Rights Reserved. */ class Curl { private $curl_object; public function __construct($p_username = "", $p_password = "", $p_timeout = 10) { $this->curl_object = curl_init(); curl_setopt($this->curl_object, CURLOPT_HTTPHEADER, Array("Accept: application/json", "Content-Type: application/json")); curl_setopt($this->curl_object, CURLOPT_CONNECTTIMEOUT, $p_timeout); curl_setopt($this->curl_object, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->curl_object, CURLOPT_SSL_VERIFYPEER, false); if(!empty($p_username) && !empty($p_password)) { curl_setopt($this->curl_object, CURLOPT_USERPWD, $p_username . ":" . $p_password); curl_setopt($this->curl_object, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } } public function get_request($p_url) { curl_setopt($this->curl_object, CURLOPT_URL, $p_url); return curl_exec($this->curl_object); } public function post_request($p_url, $p_post_data) { curl_setopt($this->curl_object, CURLOPT_URL, $p_url); curl_setopt($this->curl_object, CURLOPT_POST, true); curl_setopt($this->curl_object, CURLOPT_POSTFIELDS, $p_post_data); return curl_exec($this->curl_object); } public function close() { curl_close($this->curl_object); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/#findComment-1218974 Share on other sites More sharing options...
Maq Posted May 23, 2011 Share Posted May 23, 2011 @smazharzaidi, do not double post. I deleted your other thread. Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/#findComment-1219143 Share on other sites More sharing options...
dougjohnson Posted May 23, 2011 Share Posted May 23, 2011 Curl is great, however, there are instances where I've been able to use "file_get_contents()" and then parse the results to get what I'm after. This is simple and works in some cases. Quote Link to comment https://forums.phpfreaks.com/topic/237194-php-and-curl/#findComment-1219173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.