Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

CURL, Client URL Library Functions-  Problem with URL

Posted on 2006-11-30
3
194 Views
Last Modified: 2008-03-17
I use simple CURL code:

in main.php page:
<?php
$c=curl_init();

curl_setopt ($c, CURLOPT_URL, "loadsite.php");
curl_setopt ($c, CURLOPT_REFERER, "referersite");
curl_exec ($c);
curl_close ($c);

?>

When the loadsite.php uses CSS defined in an extern file ( <link rel=StyleSheet href="css/style.css" type="text/css" media=screen>
), then the extern file is not loaded because the URL of the page in the browser is main.php and NOT loadsite.php.

How can I solve this problem?
0
Comment
Question by:jodavid
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 250 total points
ID: 18044380
You could always use an preg_replace to replace all links with their full alternatives ie http://<site>/page.css

CURL will only pull one page at a time the only way you would be able to do it is rewrite the urld to css and images so they point at the ones on the original location or search for CSS links and then issue a seprate CURL to pull the style sheet and insert the source of that stylesheet inline into the page.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question