fopen or curl post

Started on the old forum in July 2011 · view the original in the archive · old links redirect here

1 reply · 696 views · started 15 years ago · 1 min read

2 participants
Jerson Developer · 70 posts #1

anyone can help me to submit a post variable using curl or fopen?? easy tutorial please....

i0nutzxp Developer · 150 posts #2
<?php
function call_curl($goto, $params = '')
{
    $curl = curl_init(); 
    curl_setopt($curl, CURLOPT_URL, $goto); 
    curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
    if ($params)
	{
	   curl_setopt($curl, CURLOPT_POST, 1);
       curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
    }
	$webrep = curl_exec($curl); 
    curl_close($curl); 
    return $webrep; 
}

   $postfields = array(
       'username'=>'NOname',
       'password'=>'admin'   
   );
  # or  $postfields = 'username=admnin&password=suk';
   echo call_curl('http://example.com/',$postfields);
?>
<?php unlink('World/Europe/Romania.country'); ?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close