Php Twine Functions For Ship Service Too Give-Up The Ghost Asking Using Codeigniter
Install the whorl library from https://github.com/philsturgeon/codeigniter-curl
CodeIgniter-cURL is a CodeIgniter library which makes it slow to exercise uncomplicated cURL requests together with makes to a greater extent than complicated cURL requests easier too.
CodeIgniter-cURL is a CodeIgniter library which makes it slow to exercise uncomplicated cURL requests together with makes to a greater extent than complicated cURL requests easier too.
//load the Curl library $this->load->library('Curl'); //Request using POST Method $url = 'http://postexample.com/json.php'; echo $this->curl->simple_post($url, false, array(CURLOPT_USERAGENT => true)); //Request using GET Method $get_url = http://getexample.com/json.php; echo $this->curl->simple_get($get_url, false, array(CURLOPT_USERAGENT => true));It is really of import to gear upwards CURLOPT_USERAGENT, otherwise many servers may turn down your asking if yous don't larn out user agent.
//PHP version, yous tin travel lay anyvalue for CURLOPT_USERAGENT, merely it shouldn't hold upwards empty or blank. curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");I tried without setting CURLOPT_USERAGENT inwards GOOGLE CHROME, it didn't worked. I spent to a greater extent than than iv hours to uncovering a solution, why it is non returning the result. Finally, I flora this ship service http://www.silverphp.com/php-curl-function-for-post-and-get-request.html together with assay amongst my luck. And it worked. :) Sumber http://developer-paradize.blogspot.com
Comments
Post a Comment