Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

problem with the curl_init(); commmand when tring to make a cookie

Posted on 2008-10-09
1
Medium Priority
?
211 Views
Last Modified: 2008-10-10
i am tring to make a cookie for a forum and to take a content ftom a thread
im using the command
curl_init();
now i get this problem
------------------------------------------------------------------------------------------------------------------------
HTTP/1.1 200 OK Transfer-Encoding: chunked X-Powered-By: PHP/5.2.6 Cache-Control: private, pre-check=0, post-check=0, max-age=0 Expires: 0 Pragma: no-cache Content-type: text/html Date: Thu, 09 Oct 2008 15:54:12 GMT Server: unknown
-------------------------------------------------------------------------------------------------------------
how can i fix this?

i am using this script to take the thread
please help
$ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "http://forum.doom9.org/login.php");
         curl_setopt($ch, CURLOPT_HEADER, 1);
         curl_setopt($ch, CURLOPT_NOBODY, 0);
         curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/cookies.txt");
         curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/cookies.txt");
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, "username=user&password=sedr&action=login");
         curl_exec($ch);
 
	// use this to pull up the thread you want to grab content from
         curl_setopt($ch, CURLOPT_URL, "http://forum.doom9.org/");
         $result = curl_exec($ch);
		 echo $result;

Open in new window

0
Comment
Question by:mgtm3
1 Comment
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22684583
>>now i get this problem
are you saying that's all you get back? OR are you saying you don't want the header? If you don't want the header, try:
$ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "http://forum.doom9.org/login.php");
         curl_setopt($ch, CURLOPT_HEADER, 1);
         curl_setopt($ch, CURLOPT_NOBODY, 0);
         curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/cookies.txt");
         curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/cookies.txt");
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, "username=user&password=sedr&action=login");
         curl_exec($ch);
 
	// use this to pull up the thread you want to grab content from
         curl_setopt($ch, CURLOPT_URL, "http://forum.doom9.org/");
         $result = curl_exec($ch);
	    $header_size = curl_getinfo($ch,CURLINFO_HEADER_SIZE);
		 echo substr( $result, $header_size );

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question