To restart my router I can access to web page at 192.168.1.1/tools.lp and click on the restart button.
This is the code of the page
<form name="gwRestart" method="post" action="restartingAG.lp">
<input type="hidden" name="action" id="restartAction" value="saveRestart" />
<table border='0' cellspacing='0' cellpadding='0' width='100%' style="text-align:center">
<tr>
<td>
<a href="javascript:document.gwRestart.submit();">
<div class="midarea7-1 mainButton">RESTART</div></a>
</td><td> </td>
</tr>
</table>
</form>
I would restart my router using a php page and I tried to do it with cURL in this way
$post_data['action'] = 'saveRestart';
//traverse array and prepare data for posting (key1=value1)
foreach ( $post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}
//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);
//create cURL connection
$ch = curl_init('http://192.168.1.1/restartingAG.lp');
//set options
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
//set data to be posted
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($ch);
//show information regarding the request
print_r(curl_getinfo($ch));
//echo curl_errno($ch) . '-' . curl_error($ch);
//close the connection
curl_close($ch);
Unfortunately, I noticed that my request is redirected to index_auth.lp (login function is disabled!) and not to that required.
Array ( [url] => http://192.168.1.1/index_auth.lp [content_type] => text/html [http_code] => 200 [header_size] => 858 [request_size] => 630 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 2 [total_time] => 1.216 [namelookup_time] => 0 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 7233 [speed_download] => 5948 [speed_upload] => 0 [download_content_length] => 7233 [upload_content_length] => 0 [starttransfer_time] => 0.53 [redirect_time] => 0.686 [redirect_url] => [primary_ip] => 192.168.1.1 [certinfo] => Array ( ) [primary_port] => 80 [local_ip] => 192.168.1.5 [local_port] => 50687 )
Perhaps because the request is from a different ip? Can I somehow make a request as if it were made by a user on the web page? Thanks
$post_data = array();
$post_data['action'] = 'saveRestart';
foreach ( $post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}
$post_string = implode ('&', $post_items);
$ch = curl_init('http://192.168.1.1/restartingAG.lp');
$headers = array();
$headers[] = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$headers[] = "Cache-Control: max-age=0";
$headers[] = "Connection: keep-alive";
$headers[] = "Keep-Alive: 300";
$headers[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$headers[] = "Accept-Language: en-us,en;q=0.5";
$headers[] = "Pragma: ";
//set options
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_REFERER, 'http://192.168.1.1/tools.lp');
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($ch);
curl_close($ch);
echo "<pre>";
echo $result;
From what i can, you are not to actually send your request as a POST request. Currently you are sending the message as a GET request, but with some post-data attached.
Your code is missing this line
curl_setopt($ch, CURLOPT_POST, 1);
Related
Hello StackOverflow community, I've encountered a problem when I try to use cURL methods on PHP. I tried with this sample code:
$html_brand = "www.google.com/";
$ch = curl_init();
$options = array(
CURLOPT_URL => $html_brand,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_HTTPHEADER => array("User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"),
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_ENCODING => "",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
);
curl_setopt_array( $ch, $options );
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ( $httpCode != 200 ){
echo "Return code is {$httpCode} \n"
.curl_error($ch);
} else {
echo "<pre>".htmlspecialchars($response)."</pre>";
}
curl_close($ch);
And it always ends with an error, displaying it on screen:
Return code is 0 Recv failure: Connection was reset
Or this error, when trying to reach any site with https:
Return code is 0 Failed to connect to www.google.com port 443: Timed
out
This are my settings:
Windows 7 Professional 32 bit
Apache 2.4.12
PHP 5.6.11
Is it a code error or any server configurations I have not considered?
The HTTP_HOST value in Apache is localhost:8080, which I'm not really sure if it has anything to do with my problem, but maybe it's worth noting.
Thank all of you in advance.
I've developed a custom function, that works fine for GET, POST and ajax requests.
So here it's
function spider($header = array(), $referer = false, $url, $cookie = false,$post = false)
{
if (!$cookie)
{
$cookie = "cookie.txt";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate,sdch');
if (isset($header) && !empty($header))
{
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 200);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7");
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath($cookie));
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath($cookie));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if (isset($referer) && $referer != false)
{
curl_setopt($ch, CURLOPT_REFERER, $referer);
} else
{
curl_setopt($ch, CURLOPT_REFERER, $url);
}
//if have to post data on the server
if (isset($post) && !empty($post) && $post)
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
} //endif
$data = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($info);
curl_close($ch);
if($info['http_code'] == 200){
return ($data);
}else{
return false;
}
}
so, parameters are,
$header => Headers to send to server, this should be associative array.
$referer => Referrer to current page(if any).
$url => URL that you want to get.
$cookie => cookie file, should be on the same level where the calling script is.
$post => data to post (if any)
I tested this function as follows.
echo spider(FALSE, FALSE, 'https://www.google.com/ncr');
here is header that I got.
Array
(
[url] => https://www.google.com/
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 1665
[request_size] => 701
[filetime] => -1
[ssl_verify_result] => 20
[redirect_count] => 1
[total_time] => 2.215
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 9024
[speed_download] => 4074
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0.437
[redirect_time] => 1.7
[certinfo] => Array
(
)
[redirect_url] =>
)
and here is snapshot of this request.
Hope this will help you...
I'm trying to scrap a website but it always said that Empty Reply from server
can any one look at the code and tell me what am I doing wrong?
Here is the code
function spider($url){
$header = array(
"Host" => "www.example.net",
//"Accept-Encoding:gzip,deflate,sdch",
"Accept-Language:en-US,en;q=0.8",
"Cache-Control:max-age=0",
"Connection:keep-alive","Content-Length:725","Content-Type:application/x-www-form-urlencoded",
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
,"X-Requested-With:XMLHttpRequest"
);
$cookie = "cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0); // return headers 0 no 1 yes
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return page 1:yes
curl_setopt($ch, CURLOPT_TIMEOUT, 200); // http request time-out 20 seconds
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects, need this if the URL changes
curl_setopt($ch, CURLOPT_MAXREDIRS, 2); //if http server gives redirection response
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7");
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath( $cookie)); // cookies storage / here the changes have been made
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath( $cookie));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // false for https
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,"view=ViewDistrict¶m=7&uniqueid=1397991494188&PHPSESSID=f134vrnv7glosgojvf4n1mp7o2&page=http%3A%2F%2Fwww.example.com%2Fxhr.php");
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.com/");
$data = curl_exec($ch); // execute the http request
$info = curl_getinfo($ch);
curl_close($ch); // close the connection
return $data;
}
Here is function call
echo spider("http://www.example.net/");
Edit
Array ( [url] => http://www.example.net/ [content_type] => text/html [http_code] => 301 [header_size] => 196 [request_size] => 840 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 61.359 [namelookup_time] => 0 [connect_time] => 0.281 [pretransfer_time] => 0.281 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 178 [upload_content_length] => 0 [starttransfer_time] => 60.593 [redirect_time] => 0.766 [certinfo] => Array ( ) [redirect_url] => ) Empty reply from server
this is the header now
also I'd updated my post data
it's now
curl_setopt($ch, CURLOPT_POSTFIELDS,"view=ViewDistrict¶m=7&uniqueid=".time(). rand(101,500)."&PHPSESSID=f134vrnv7glosgojvf4n1mp7o2&page=http%3A%2F%2Fexample.com%2Fxhr.php");
and also had removed "X-Requested-With:XMLHttpRequest" from headers
Have you tried removing this from the headers ?
X-Requested-With:XMLHttpRequest
My guess is that your problem is in this line:
curl_setopt(
$ch,
CURLOPT_POSTFIELDS,
"view=ViewDistrict¶m=7&uniqueid=1397991494188&PHPSESSID=f134vrnv7glosgojvf4n1mp7o2&page=http%3A%2F%2Fwww.example.com%2Fxhr.php"
);
Notice that you're passing a value for PHPSESSID. I'm guessing you copied & pasted a URL from a visit to the site, right? That session ID was probably valid when you visited the site, but the odds of it being valid now are pretty slim. And if the server doesn't like the session ID, chances are it's not going to give you any data.
here is my URL: https://webservices-dev.compuscan.co.za:9443/PersonStatusService/user2/password2/8310240031083/XML
i am try to get its content with PHP curl but no success hope some can help.
here is my code:
// you can add anoother curl options too
// see here - http://php.net/manual/en/function.curl-setopt.php
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_POST, TRUE); // Use POST method
//curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=1&var2=2&var3=3"); // Define POST values
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
$output = curl_getinfo($ch);
print_r($output);
curl_close($ch);
return $data;
}
$url = "https://webservices-dev.compuscan.co.za:9443/PersonStatusService/user2/password2/8310240031083/XML" ;
$variablee = get_data($url);
echo $variable;
Well i am getting results as expected.
It should be
$variablee = get_data($url);
echo $variablee; //<--- Must be $variablee (as you have defined it above)
OUTPUT:
Array ( [url] =>
https://webservices-dev.compuscan.co.za:9443/PersonStatusService/user2/password2/8310240031083/XML
[content_type] => text/plain; charset=utf-8 [http_code] => 200
[header_size] => 81 [request_size] => 192 [filetime] => -1
[ssl_verify_result] => 19 [redirect_count] => 0 [total_time] => 1.544
[namelookup_time] => 0 [connect_time] => 0.343 [pretransfer_time] =>
1.186 [size_upload] => 0 [size_download] => 656 [speed_download] => 424 [speed_upload] => 0 [download_content_length] => 656
[upload_content_length] => 0 [starttransfer_time] => 1.544
[redirect_time] => 0 [certinfo] => Array ( ) [primary_ip] =>
196.34.30.23 [primary_port] => 9443 [local_ip] => 192.168.72.37 [local_port] => 61090 [redirect_url] => )
8310240031083CLAIRECSAPLARN1983/10/24FY2012/03/242013/09/308 SKALIE
STWEST ACRES EXT 1312012013/08/130768333118
function get_data($url) {
$ch = curl_init($url);
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0;
Windows NT 6.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode == 404) {
curl_close($ch);
return '404';
} else {
curl_close($ch);
return $data;
}
}
This function worked perfectly for me, maybe somebody finds it useful as I did. I'm not pretending to answer your question (well, I'm 9 months late) but solve people's similar questions about a similar issue.
My first post here... I am handling cookies between get/post pair of requests.
Based on this other question:
share the same cookie between two website using PHP cURL extension
Is my approach correct?
<?php
//set POST variables
$referer = 'http://www.correios.com.br/encomendas/prazo/';
$url = 'http://www.correios.com.br/encomendas/prazo/prazo.cfm';
$fields = array(
'Altura' => '8',
'Comprimento' => '16',
'Formato' => '1',
'Largura' => '15',
'MaoPropria' => 'N',
'avisoRecebimento' => 'N',
'cepDestino' => '99999999',
'cepOrigem' => '99999999',
'data' => '02/12/2012',
'dataAtual' => '02/12/2012',
'embalagem' => '',
'peso' => '1',
'resposta paginaCorreios'=> '',
'servico' => '99999',
'valorD' => '',
'valorDeclarado'=> ''
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, '10');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
// Post 1
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_URL, $referer);
$result = trim(curl_exec($ch));
//
$ch = curl_init($url);
//Post 2
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_REFERER, $referer);
//execute post
$result = curl_exec($ch);
//
//close connection
curl_close($ch);
echo($result);
?>
What I need is mimic this behavior:
Response Headers:
Content-Type text/html; charset=ISO-8859-1
Date Sun, 02 Dec 2012 20:13:08 GMT
Server Microsoft-IIS/7.5
Set-Cookie JSESSIONID=c6308c7edb989a54edef1b656119101c321b;path=/ CFGLOBALS=urltoken%3DCFID%23%3D33736896%26CFTOKEN%23%3D28355865%26jsessionid%23%3Dc6308c7edb989a54edef1b656119101c321b%23lastvisit%3D%7Bts%20%272012%2D12%2D02%2018%3A13%3A09%27%7D%23timecreated%3D%7Bts%20%272012%2D12%2D02%2002%3A13%3A29%27%7D%23hitcount%3D6%23cftoken%3D28355865%23cfid%3D33736896%23;expires=Tue, 25-Nov-2042 20:13:09 GMT;path=/
Transfer-Encoding chunked
Request Headers:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3
Connection keep-alive
Cookie CFID=33736896; CFTOKEN=28355865; CFGLOBALS=urltoken%3DCFID%23%3D33736896%26CFTOKEN%23%3D28355865%26jsessionid%23%3D983074629e3d7344ff534b12637b7f127163%23lastvisit%3D%7Bts%20%272012%2D12%2D02%2002%3A56%3A48%27%7D%23timecreated%3D%7Bts%20%272012%2D12%2D02%2002%3A13%3A29%27%7D%23hitcount%3D5%23cftoken%3D28355865%23cfid%3D33736896%23
Host www.correios.com.br
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20100101 Firefox/17.0
Reading from some others topics, I have learned about multi_exec:
PHP cURL multi_exec delay between requests
I mean, what is the correct approach for the this task?
Thanks in advance!
Renato
Trying to do some local testing on a virtual server, the problem is cURL is returning a http_code => 0
I think it's to do with my virtual host naming.
Virtual Host Name: dev.project
the cURL request is adding http://
if I ping: dev.project from the command line, I get a hit.
If I try it with http://dev.project I get unknown host.
Is there a curl_setopt option just to use the hostname? I'm no sure if I can use the IP as there are several projects on the server, or would Apache handle this?
Here is what I have tried:
$request_url = 'dev.project';
$request_args = 'parm=1234';
$user_agent = 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16';
$ch = curl_init();
// set curl options (GET)
curl_setopt($ch, CURLOPT_URL, $request_url.'?'.$request_args);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
//curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
//curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
//curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // CHANGE THIS TO TRUE
// Set curl options (POST)
//curl_setopt($ch, CURLOPT_URL, $request_url);
//curl_setopt($ch, CURLOPT_POST, TRUE);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $request_args);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
//curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
//curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
echo "<pre>".print_r($response,true)."</pre><br />\n"; // nothing is returned
print_r(curl_getinfo($ch));
curl_close($ch);
Response from curl_getinfo() : (NOTE: the http:// is pre-pended in the url)
Array
(
[url] => http://dev.project?parm=1234
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0
[redirect_time] => 0
)
If anyone has this issue, here is the fix:
// This is your Virtual Hosts name
$request_host = 'dev.project';
// This is the IP
$request_url = '192.168.0.1';
$headers = array("Host: ".$request_host);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $request_url.'?'.$request_args);
curl_setopt($ch, CURLOPT_HEADER, FALSE);