Advertisement

09.14.2008 at 04:40AM PDT, ID: 23729922
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

CURL post form with cookies

Asked by Alexander_Savenko in PHP Scripting Language, Asynchronous Javascript and XML (AJAX)

Tags:

Dear experts, I want to send a form with POST method via CURL and then retrieve the answer. But i have 2 problems: 1) When a i am trying to post data to this server and check the results of my CURL script i recieved in browser that this server only work if cookies are enable in my browser 2) I want to send my data to AJAX form
I manually stored a cookie file when i visit that server and use in my script as in my code example.  But again it responds the still error. What i have to do? What i am doing wrong?
And after how to work with AJAX forms on server? CURL can work with AJAX post forms?

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function curl_login($url,$data,$proxy,$proxystatus){
 
      $cookie_jar = "cookie.txt";
      $ch = curl_init("$url");
      curl_setopt($ch, CURLOPT_HEADER, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_VERBOSE, 1);
      curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;MSIE 5.01; Windows NT 5.0)");
      curl_setopt($ch, CURLOPT_COOKIEJAR, "$cookie_jar");
      curl_setopt($ch, CURLOPT_COOKIEFILE, "$cookie_jar"); 
      curl_setopt($ch, CURLOPT_URL, "$url");  
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
      curl_setopt($ch, CURLOPT_REFERER, "http://www.mysite.com");
      curl_setopt($ch, CURLOPT_POST, TRUE);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
      curl_setopt($ch, CURLOPT_TIMEOUT, 40);
      $result=curl_exec($ch);
      print $result; 
      curl_close($ch);
 
}
Related Solutions: CURL with cookies problem
 
 
[+][-]09.14.2008 at 10:24AM PDT, ID: 22473468

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, Asynchronous Javascript and XML (AJAX)
Tags: PHP
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628