| | |
curl not working for getting a web page content, why?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 33
Reputation:
Solved Threads: 0
Hi all
i am using a curl script to go to a link and get its content for further manipulation. following is the link and curl script:
but the website is not excepting it through script it is giving user exception in result, but if we normally paste the url in browser it is opening the page perfectly alright.
Please help, what i am doing wrong here.
Thanks and regards
jyotiu
i am using a curl script to go to a link and get its content for further manipulation. following is the link and curl script:
PHP Syntax (Toggle Plain Text)
<?php $url = 'http://criminaljustice.state.ny.us/cgi/internet/nsor/fortecgi?serviceName=WebNSOR&templateName=detail.htm&requestingHandler=WebNSORDetailHandler&ID=368343543'; //curl script to get content of given url $ch = curl_init(); // set the target url curl_setopt($ch, CURLOPT_URL,$url); // request as if Firefox curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") ); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result= curl_exec ($ch); curl_close ($ch); echo $result; ?>
but the website is not excepting it through script it is giving user exception in result, but if we normally paste the url in browser it is opening the page perfectly alright.
Please help, what i am doing wrong here.
Thanks and regards
jyotiu
Last edited by jyotiu; May 2nd, 2009 at 1:29 am.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Unable to connect to the database!
- Next Thread: ajax with Html
| Thread Tools | Search this Thread |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip javascript joomla limit link login mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem protocol query radio random recursion recursiveloop remote script search server sessions sms smtp soap source space sql strip_tags subversion support! syntax system table template tutorial undefined update upload url validator variable video virus web window.onbeforeunload=closeme; youtube





