Category : curl

Im trying to make a post request in laravel to a payment endpoint with the following code <?php namespace AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportFacadesHttp; class AddCardController extends Controller { // public function index() { return view(“addcard”); } public function requestPayment(Request $request) { $paystack_key = config(“app.paystack_key”); $url = “https://api.paystack.co/transaction/initialize”; $email = $request->user(“distributors”)->email; $fields = [ “email”=>$email, ..

Read more

Hello how can i implement Paypal in Laravel, and what i’m missing? I’ve done 5-6 Tutorials and spended tens of hours during the last months on this and rage quited quite often. I’ve tried smrklive, the new paypal PHP SDK and without sdk, with curl, with guzzle etc. but i’ve still haven’t any idea what ..

Read more

I am trying to use the http::post helper in Laravel to send a post request to a endpoint. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ‘https://example/includes/api.php’); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( $payload ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); echo $response; The above will work just fine, and is acceptable in response – as ..

Read more

I need to call internally(with content) in laravel public function callingFunction(Request $request) { //login user $this->getSession(‘MY_USER_LOGIN’); $userId = Auth::id(); //logged userid is available – ok //call another controller $curl = curl_init(‘another_addres_on_server_for_callTo_function’); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_COOKIESESSION, true); $laravel_cookie = $request->cookie(‘laravel_session’); //cookie is available – OK curl_setopt($curl, CURLOPT_COOKIE, "laravel_session=".$laravel_cookie); $response = curl_exec($curl); curl_close($curl); ..

Read more

I have a set of requests and responses saved in files as raw petitions. The files are like this: –MIME_Boundary Content-ID: <[email protected]> Content-Type: application/xop+xml; type="text/xml"; charset=utf-8 Content-Transfer-Encoding: 8bit <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><ns2:LoadFileResponse xmlns:ns2="http://ws.loadfile.com/loadfile/ws/LoadFileService" xmlns:ns3="http://ws.loadfile.com/loadfile/ws/CheckFileService"><ns2:responseFile><ns2:status>wait</ns2:status><ns2:fileId>2356</ns2:fileId></ns2:responseFile></ns2:LoadFileResponse></soap:Body></soapenv:Envelope> –MIME_Boundary– I want to show in a blade template with syntax highlight and code formatted. I used highlight.js to ..

Read more

I have this code : $httpParams = [ ‘textData’ => $content, ‘xmlFile’ => new CurlFile($params[‘file’]->getPathName()) ]; $curlHandle = curl_init(‘http://url.com’); curl_setopt($curlHandle, CURLOPT_HEADER, false); curl_setopt($curlHandle, CURLOPT_POST, true); curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $httpParams); curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); $curlResponse = curl_exec($curlHandle); curl_close($curlHandle); dump($curlResponse);die(); I have the response in $curlResponse with status = 200 But when I tried with Http from laravel : ..

Read more

I am trying to post the below as content-type application/x-www-form-urlencoded using Laravels Http Client: $params = [ ‘client_secret’ => config(‘client_secret’), ‘client_id’ => config(‘client_id’), ‘grant_type’ => ‘client_credentials’, ‘scope’ => ‘authorization:grant’ ]; $url = "https://api.example.org/api/v1/oauth/token"; $post = Http::asForm()->post($url, $params); However, this returns a GuzzleHttp response, with the status 400 Bad Request. Trying the same request with cURL ..

Read more

I am new to Laravel development, and I spent the last 5 hours trying to get a Laravel project up and running using Docker (which apparently is obligatory). Every single time I try to create a new Laravel project using the provided curl cmd, it says Docker is not running although it is. Literally spent ..

Read more

We are implementing a custom chat in an web application using laravel and pusher. The basic functionalities like sending and receving messages with file sharing was working perfectly fine for few days but all of a sudden we encountered an error as follows: "message": "cURL error 60: SSL: no alternative certificate subject name matches target ..

Read more

Hello everyone i have been having some errors in recent times and the error seems to be from my localhost. below is the error Error. Please try again.cURL error 77: error setting certificate verify locations:n CAfile: C:wamp64binphpphp7.4extrassslcacert.pemn CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) Checked online and i have followed all the instructions and solutions provided but there ..

Read more

$user_access =’example’; $user_key = ‘examplekey’; $payload = json_encode($arr); $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,’example.com/api/users/2′); curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’,’Content-Length: ‘ . strlen($payload))); curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, ‘PUT’); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $payload ); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_USERPWD, $user_access . ":" . $user_key); if (curl_exec($curl_handle) === FALSE) { die("Curl Failed: " . curl_error($curl_handle)); } else { return curl_exec($curl_handle); }; When I remove the curl_setopt($curl_handle, ..

Read more

need help. im stop with this situation, i got an error that i don’t understand. i think because i am weak in this. i have API payment and i use CURL. i actually get the encoded value but when i try using CURL to pas the value to API. i got this setContent() must be ..

Read more

in laravel 7 in one of my jobs I send a http request and for 95 percent of them I get html response. Request $url = "some url"; /** * Request with Guzzle and xml */ $response = Http::retry(3, 1000)->timeout(60)->withHeaders([ ‘User-Agent’ => ‘curl/7.65.3’, ‘Accept’ => ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8’, ‘Accept-Encoding’ => ‘gzip, deflate, br’, ])->withOptions([ ‘referer’ => true, ..

Read more

Trying to test a private channel for notifications through Pusher using the Laravel 8 framework on a local Laragon server I can’t get to understand what causes this error. I have the php.ini configured properly (I hope) for SSL and I can access the local https domain ;; php.ini extension=openssl curl.cainfo = "C:/laragon/etc/ssl/cacert.pem" openssl.cafile = ..

Read more

I am trying to make a curl request like below within laravel curl -H "Authorization: bearer xxx" -X POST -H ‘Tus-Resumable: 1.0.0’ -H ‘Upload-Length: 900000000’ ‘https://api.cloudflare.com/client/v4/accounts/xxx/stream?direct_user=true’ I tried this in my controller public function createVideo(){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ‘https://api.cloudflare.com/client/v4/accounts/xxx/stream/’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{"maxDurationSeconds": 3600}"); curl_setopt($ch, CURLOPT_POST, 1); $data = [‘direct_user’=>’true’]; curl_setopt($ch, ..

Read more

I have started using the "Amazon payfort payment service", but I’m facing some issues. I am trying to get the transaction information based on the Api example, but I always get the error "Operation not allowed: CAPTURE" This is my curl request: curl -H "Content-type: application/json" -XPOST -d ‘{ "command": "CAPTURE", "access_code": "Xw************", "merchant_identifier": "51*****", ..

Read more

I am facing error: cURL error 60: SSL certificate problem: certificate has expired (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) php 7.2.5 laravel. I have screenshot of error. kindly Help for me.. I done php.in file error solution as many persons provide this solution but not worked for me.. how I handle this error kindly help..enter image description here Source: ..

Read more

I am new to docker for Windows and have this setup wherein 2 repos have its own docker-compose.yml file. One is for the API while the other is for the APP. API docker-compose.yml version: ‘3’ networks: my_network: name: my_network ipam: config: – subnet: 172.23.0.0/24 services: my_api: build: context: . dockerfile: .docker/site.dockerfile container_name: my_api ports: – ..

Read more

I want to use a package (Cloudinary) to upload an image, after all the setup, I am getting an error This is the code from Cloudinary documentation, $uploadedFileUrl = cloudinary()->upload($request->file(‘profile_image’)->getRealPath())->getSecurePath(); So I can’t set Guzzle verification to false in this way $client = new Client([ ‘base_uri’ => ” , ‘headers’ => $headers, ‘verify’ => false, ..

Read more