473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

cURL post data to asp.net page

I am trying to call the __doPostback javascript function in a asp.net page from php using curl.
I used below code but getting error like
Encountered error while processing the request. Please try again using the Home button.

Diagnostic Information:
Error Type: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Expand|Select|Wrap|Line Numbers
  1. $url = "http://opanet.hrsa.gov/OPA/Reports/Reports.aspx";
  2. $params = array(
  3.     'aspnetForm' => '',
  4.     '__EVENTTARGET' => 'ctl00$cphMainContent$tvReports',
  5.     '__EVENTARGUMENT' => 'sDaily Reports Menu\\Real-time Reports\\CE Real-time Report'
  6. );
  7.  
  8.  
  9. $ch = curl_init();
  10.  
  11. curl_setopt($ch, CURLOPT_URL, $url);
  12. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 900);
  13. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)");
  14.  
  15. curl_setopt($ch, CURLOPT_HEADER, 0);
  16. curl_setopt($ch, CURLOPT_POST, 1);
  17.  
  18. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  19. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  20. curl_setopt($ch, CURLOPT_AUTOREFERER, true );
  21.  
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
  23. curl_setopt($ch, CURLOPT_FAILONERROR, 0);
  24.  
  25. curl_exec($ch);
  26.  
  27. curl_close($ch);
  28.  
Dec 18 '11 #1
0 1748

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: brendan | last post by:
Sorry this isnt a cross post .. i just didnt get any help from alt.php. I have a website which utilises post forms for navigation in some areas. Problem is, when *some* users hit the BACK button...
2
by: desalvo123 | last post by:
Is there a way I can manually create and send POST data in my code to a website without using html forms?
1
by: Mad Scientist Jr | last post by:
How do you get a ASP.NET page to return nothing, so the page posting form data to it doesn't reload? I have tried all combinations of the following: Response.SuppressContent = True...
0
by: Glen | last post by:
Is there any way to post data to an ASP.Net form and then display the page to the user with the posted data from a client app? Here's what I'm trying to do: Serialize a business object (order)...
15
by: tmax | last post by:
PHP Pros: I have a simple html form that submits data to a php script, which processes it, and then redisplays the same page, but with a "thank you" message in place of the html form. This is...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
4
by: David Veeneman | last post by:
I want to programmatically create some POST data on a web server, then pass that data to another web page that the server calls, using Server.Transfer(). What's the best way to do that? I'm...
4
by: dac | last post by:
I am quietly going insane on this project. I've never worked on a project like this one before. All my previous sticky forms were for data entry, not editing. I don't know how to display the form...
0
by: thirunavukarasukm | last post by:
Hai,, i want to post data with screen scrap page.. i want to send from to destination station which class and date... i run the screenscrap.aspx page the posted data send to the request...
1
by: JohnathanKong | last post by:
Hello, I hope this is the right place to post, but anyways, here goes. I current have a forum, snitz, in place, but am having an IE specific problem. Basically what happens is, I have a page that...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.