Problem is that sometimes PHP Curl library not works on GoDaddy Host. Why curl is not working and how to solve this issue is what this post is all about.
I was trying to use curl library in my php code. But was soon tired of seeing numerous failures. My code was pretty much neet [those who know me know that well. I like cleanliness!! ;) ].
Still I was getting timeouts or some or the other errors , as I tried playing between parametrs. It was after some research over the internet and the manual, I found out that the trouble was because of host. Actually, GoDaddy uses a proxy server.
Voila!! You got it!!
So now on, if anyone uses GoDaddy as host and wants to use the curl library in his codes, has to just tweak his code by some additional lines.
Let us assume that $hn is the curl handler.
Then you have to include this line in your PHP Code---
curl_setopt($hn, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($hn, CURLOPT_PROXY,"http://64.202.165.130:3128");
Lets see an example..
<?php
$url = "http://www.meonshow.com/";
$hn = curl_init();
curl_setopt ($hn, CURLOPT_URL, $url);
curl_setopt ($hn, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($hn, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($hn, CURLOPT_PROXY,"http://64.202.165.130:3128");
curl_setopt ($hn, CURLOPT_TIMEOUT, 120);
$res = curl_exec ($hn);
if(is_int($res)) {
die("Error occured: " . curl_errno($hn) . " : " . curl_error($hn));
}
curl_close ($hn);
print "Target URL: " . $url . " " . $res;
?>
Now, you may as thanks click on few of the advertisements links. Do it man!!
Learning with learners
W3LC brings you Discussions For IT People. Stuffed with personal touch & humor by Anwar Jamal Faiz.
A great place to read and participate in IT discussions. With over 1.5 million hits from bright technical minds across the globe, W3LC urges to read, enjoy, and comment. Learning, ofcourse, would just be a side-effect. Also visit MeOnShow. And, Technology Job Puzzles.
Subscribe to:
Post Comments (Atom)
The Haryana Police exam is expected to be held in Feb 2017. The Haryana Police Exam date will be announced soon
ReplyDeleteExcellent informative blog, keep for sharing.
ReplyDeleteBest System Integration services | Massil Technologies
There are so many platforms for website designing like static HTML, flash websites and many more. PHP is one such platform that effectively works the best for custom cutting-edge web solutions. Another major feature for opting PHP is the cost advantage. plakatų maketavimas
ReplyDeleteFor this we give task based software engineer group to comprehend the need of a specific undertaking. Top Expert Cakephp Developers
ReplyDeleteIn PHP you require investigating devices to find bumbles and sees, yet the issue is there are only two or three them open in connection with other programming lingos like Python.Why use Laravel
ReplyDeleteUnder "reasonable use", certain employments of copyright material would not be encroaching, for example, use for scholarly purposes, news announcing and so on.https://www.apkmacpc.com/itools-crack/
ReplyDeleteWant to more update like this from you. please keep it up.
ReplyDeleteonline classified ads platform in Bangladesh
I'm not reading your blog!! I am seeing your animation skill in programming.. wow! just amazing.
ReplyDeleteGypsum Design Price in BD
Ecotechnology is environmental consulting companies most aware about ecological systems. They provides different kinds of services related about this.
ReplyDeleteDiligent Security is a leading security company in Canada that provides top-notch security services and guard training. Safety & peace of mind.
ReplyDeleteSecurity Services
Ontario Security License
Security Guard License Training
This very informative and interesting blog.
ReplyDeleteSecurity guard Services