Category : curl

I am trying to dump data at server side with this code $ch = curl_init(‘http://test.com/usage_log’); $data = array(‘abc’ => $abc); $post_data = $data; log_message(‘error’,http_build_query($post_data)); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); and below is server side code that I am using to receive the data $abc = $_REQUEST[‘abc’]; But ..

Read more

I have a code similar to the following: $ch = curl_init(); // … curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($ch, $header_line) { // process $header_line… return strlen($header_line); // needed by curl }); // … curl_exec($ch); After that code I’d like to keep using $ch to re-use the connection, but I don’t need the custom CURLOPT_HEADERFUNCTION callback anymore. How ..

Read more

My problem is the following I have a HTML web form <!DOCTYPE html> <html lang="en"> <head> <title>FORM</title> <body> <form action="/form/send/alex.php" method="post" > Name: <input type="text" name="name" value="name"><br> E-mail: <input type="text" name="email" value="email"><br> <input type="submit"> </form> </body> </html> And I want to ingest/ship the user input into Elasticsearch with php curl, but this is not working ..

Read more

I’m using GuzzleHttpClient to send message. how to make a phone number clickable? $apiURL = ‘https://api.telegram.org/bot’ . $apiKey . ‘/’; $client = new GuzzleHttpClient([‘base_uri’ => $apiURL]); $message = $event->getTitle() . ‘ ‘ . $event->contact; $response = $client->post(‘sendMessage’, [ ‘multipart’ => [ [ ‘name’ => ‘chat_id’, ‘contents’ => $chatID ], [ ‘name’ => ‘text’, ‘contents’ => ..

Read more

I am trying to read eldorado web page using CURL: $curl = curl_init(); $url = "https://eldorado.ua/smartfon-samsung-galaxy-a52-8256-gb-black-sm-a525-fzkisek-/p71321565/"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_AUTOREFERER, false); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt( $curl, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16’ //’Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac ..

Read more

We have the code below: $curlbat = curl_init(); $url = ‘https://’.$hostsp.$rest_apispins; $method = ‘GET’; $body = ”; $headers = $signer->getHeaders($url, $method, $body, ‘application/json’); $curlbatOptions = [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => ”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 50, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $headers, CURLOPT_HEADER => ..

Read more