You are here: CURL and PHP Redirect « PHP Programming Language « IT news, forums, messages
CURL and PHP Redirect

Posted by niftyhawk on 11/18/31 11:42

Hi All,

I have a small curl function which spits out a bunch of headers.

The CURL Code is:

$url="http://blahblah.com?Logon";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($ch, CURLOPT_REFERER,
"http://blahblah.com/default.asp?v=");
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS,
"FormId=0&Config=0&RedirectURL=$RedirectURL&Identification=$UserID&Verification=$Password&DB=$DB&RememberLogon=1&UseEnhancedContent=1");
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'Ocookie.txt');
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);
print $content;


The HTML sspit out by the above code is:

HTTP/1.1 100 Continue Server: Microsoft-IIS/5.1 Date: Fri, 17 Mar 2006
00:14:25 GMT X-Powered-By: ASP.NET HTTP/1.1 200 OK Server:
Microsoft-IIS/5.1 Date: Fri, 17 Mar 2006 00:14:25 GMT X-Powered-By:
ASP.NET Connection: close Content-Type: text/html Refresh: 0;
URL=http://blahblah.com/default.asp?v= Set-Cookie: osaa=guest;
expires=Monday, 16-Mar-2009 00:14:25 GMT; path=/ Set-Cookie:
osab=guest; expires=Monday, 16-Mar-2009 00:14:25 GMT; path=/

All this is printed along with the existing HTML on which the above
curl code is written. How do I redirect the existing page to the one
setup in the headers by making sure of passing the whole header
information which is spit out by the curl code?

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация