fanfavorite Posted July 25, 2008 Share Posted July 25, 2008 Ok, I am trying to use cURL to read from an ASP page. I wanted to use file_get_contents, however the server blocks it. When I use cURL and echo the results, I get the error: Microsoft JScript runtime error '800a138f' 'length' is null or not an object /CommonFunctions.asp The code is: $URL1 = "http://www.somewebsite.com/somefile.asp"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL,$URL1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); $buffer = curl_exec($ch); echo $buffer; curl_close ($ch); Any ideas on how to get around this? The code just stops at this error. Thanks. Link to comment https://forums.phpfreaks.com/topic/116613-solved-php-curl-of-an-asp-page/ Share on other sites More sharing options...
fanfavorite Posted July 25, 2008 Author Share Posted July 25, 2008 I just want to be able to be able to read in the page as it is displayed in html when I go to the site. Link to comment https://forums.phpfreaks.com/topic/116613-solved-php-curl-of-an-asp-page/#findComment-599608 Share on other sites More sharing options...
fanfavorite Posted July 25, 2008 Author Share Posted July 25, 2008 Heres a live example of problems reading asp pages: <? $URL1 = "http://www.w3schools.com/asp/default.asp"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL,$URL1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); $buffer = curl_exec($ch); echo $buffer; curl_close ($ch); ?> It stops at the <body> tag. Link to comment https://forums.phpfreaks.com/topic/116613-solved-php-curl-of-an-asp-page/#findComment-599647 Share on other sites More sharing options...
fanfavorite Posted July 25, 2008 Author Share Posted July 25, 2008 Adding: curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); Seems to work fine. Link to comment https://forums.phpfreaks.com/topic/116613-solved-php-curl-of-an-asp-page/#findComment-599761 Share on other sites More sharing options...
awpti Posted July 26, 2008 Share Posted July 26, 2008 Oops, [solved] didn't see it Link to comment https://forums.phpfreaks.com/topic/116613-solved-php-curl-of-an-asp-page/#findComment-599851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.