I am having this error cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
after saving/creating multiple models to database.
I have this in my controller:
public function storeTruck(Request $request){
//Save Company Detail
$company = Company::Create($request->only(['company']));
// Save Trucker Info
$request->request->add(['password'=>bcrypt('trucker')]);
$request->request->add(['company_id'=>$company->id]);
$trucker = Trucker::create( $request->only([
'first_name','last_name','company',
'email','contact', 'password', 'company_id'
]));
return view('admin.truck.list');
}
Those models are saved successfully in database but it will then proceed to a cURL error 3
problem. What causes this error based on the codes? Please advice. Thanks.
The error curl: (3) URL using bad/illegal format or missing URL could be caused by a character issue with the passwords. Characters such as @ or & or other symbols may be problematic on the command line. To fix this issue, add double quotes around your URL.
This violation indicates that a request that was not created by a browser, and does not comply with HTTP standards, has been sent to the server. This may be the result of of an HTTP request being manually crafted or of a client tunneling other protocols over HTTP.
I made a mistake when instantiating the the Guzzle Client Object:
Rather than assigning my baseUrl to th 'base_uri' key as below,
$client = new Client([
'base_uri' => $this->baseUrl
]);
I assigned the $baseUrl to the 'base_uri' key, which does not exist.
$client = new Client([
'base_url' => $this->baseUrl
]);
Be careful when doing this. make sure you use 'base_uri' instead of 'base_url.
This error is due to the URL is not correct. Check the cURL error 3: check this link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With