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
ReplyDeleteGreat Article Cyber Security Projects projects for cse Networking Security Projects JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
DeleteExcellent 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
ReplyDeleteWow! Great article! It inspired me to make my own blog
ReplyDeleteWeb Hosting in Pakistan
One of the best blog posts I've read! Thanks a ton for sharing this!
ReplyDeleteWeb Hosting in Malaysia
For 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/
ReplyDeleteForex Signals, MT4 and MT5 Indicators, Strategies, Expert Advisors, Forex News, Technical Analysis and Trade Updates in the FOREX IN WORLD
ReplyDeleteForex Signals Forex Strategies Forex Indicators Forex News Forex World
Hey! Finally we are launch 150+ High DA Dofollow Quality Backlinks here! Order Now and Boost your website ranking.
ReplyDeleteManual Backlinks | Quality Backlinks | Dofollow Backlinks | High Quality Backlinks
Thank you!
DigiPeek
Shield Security Solutions Provides Ontario Security Training, Security Guard License or Security License in Ontario. Get Started Today
ReplyDeleteShield Security Solutions Offers Security Guard License Training across the province of Ontario. Get Started Today!
ReplyDeleteSecurity Guard License | Security License | Ontario Security license | Security License Ontario | Ontario Security Guard License | Security Guard License Ontario
Want to more update like this from you. please keep it up.
ReplyDeleteonline classified ads platform in Bangladesh